|
-
Aug 21st, 2024, 11:18 AM
#1
Thread Starter
New Member
Help me get this image
So I'm trying to extract a picture from the website https://libremdb.pussthecat.org/ (witch is a site for privacy, taking its information from IMDb)
I use HtmlAgilityPack to extract the image of the movie or show, witch i successfully did with https://www.themoviedb.org/. My problem right now is that i can't get the image with pussthecat (I tried to use IMDb but was unable to get the image because its harder (at least for me)) because the Xpath I'm retrieving is the wrong one but there are multiple images in there. The URL i get is the one without width and height (witch is necessary for the image) i know its hard to understand so i will give you some example links and Xpath:
Xpath: /html/body/div/main/section[1]/div[1]/img
Random movie Image: Go to https://libremdb.pussthecat.org/ search for any movie right click the image and open in a new tab.
Right now i cant think of anything else but please tell me in the comments.
Last edited by Lordloser; Aug 21st, 2024 at 11:22 AM.
Reason: Fixed the title
-
Aug 22nd, 2024, 08:29 AM
#2
Re: Help me get this image
Looking at the source code, it appears as though they provide the JSON that powers the page in the document via the #__NEXT_DATA__ script element.
So for example, I can do this from my console:
- Get the script tag by calling
Code:
document.querySelector('#__NEXT_DATA__')
- Get the JSON literal by calling
Code:
JSON.parse(document.querySelector('#__NEXT_DATA__').innerText)
- Traverse the JSON by accessing
Code:
props.pageProps.data.results.titles[0].image
So to do this from VB.NET, you would use your HtmlAgilityPack to parse the HTML and select the #__NEXT_DATA__ script element. Use JSON.NET or Newtonsoft.JSON to parse the JSON literal to a strongly typed class. And then finally access the property via the path above.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|