Skip to content

Commit

Permalink
Fri, Aug 2, 2024, 11:08 PM +03:00
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdoullahBougataya committed Aug 2, 2024
1 parent 7230feb commit 1725241
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
39 changes: 39 additions & 0 deletions images/AJ-10-190.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions images_scrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
wikipedia_link = str(the_link.get('href')).removeprefix("/url?q=").split("&")[0]
r = requests.get(wikipedia_link)
soup = BeautifulSoup(r.text, "html.parser")
if soup.find("table", {"class" : "infobox"}).find_all("img")[0].get("srcset"):
img_data = requests.get("https:" + str(soup.find("table", {"class" : "infobox"}).find_all("img")[0].get("srcset").split()[2])).content
if soup.find("table", {"class" : "infobox"}).find("td", {"class": "infobox-image"}).find("img").get("srcset"):
img_data = requests.get("https:" + str(soup.find("table", {"class" : "infobox"}).find("td", {"class": "infobox-image"}).find("img").get("srcset").split()[2])).content
with open(f'images/{engine_name}.jpg', 'wb') as handler:
handler.write(img_data)

0 comments on commit 1725241

Please sign in to comment.