Skip to content

Commit

Permalink
[driver details] fix image article parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightDV committed May 7, 2024
1 parent 4468eed commit 2cd5da7
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/scraping/formula_one.dart
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,12 @@ class FormulaOneScraper {

List<dom.Element> tempDriverArticles =
document.getElementsByClassName('f1-driver-article-card');
for (var element in tempDriverArticles) {
for (dom.Element element in tempDriverArticles) {
if (element.attributes['href'] != null) {
results[1].add(
[
element.attributes['href']!.split('.').last,
element.children[0].children[0].attributes['src']!,
element.getElementsByTagName("img").first.attributes['src']!,
element.children[0].children[1].children[1].text,
element.children[0].children[1].children[0].text,
],
Expand All @@ -399,19 +399,14 @@ class FormulaOneScraper {
document.getElementsByClassName('f1-carousel__slide');
for (var element in tempDriverMedias) {
String imageUrl = element.firstChild!.firstChild!.attributes['src'] ?? '';

results[3][0].add(imageUrl);
}

print("gllery ok");

tempDriverMedias = document.getElementsByClassName('gallery-description');
for (var element in tempDriverMedias) {
results[3][1].add(element.text);
}

print("gallery desc ok");

return results;
}

Expand Down

0 comments on commit 2cd5da7

Please sign in to comment.