How to fetch information from a table on a webpage #94
Unanswered
akoredenitan
asked this question in
Q&A
Replies: 1 comment
-
It seems like the issue might be with how you're specifying the wanted list for scraping the CPU information. Make sure you're targeting the correct elements in the HTML table. Additionally, ensure that the webpage structure hasn't changed since you last checked. You might need to adjust your scraping logic accordingly. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
I am relatively new to Web-scraping and saw this while working on another project.
I would like to fetch information from a table on a webpage when I specify the model of the CPU in my wanted list, I get an empty array returned most time with the exception of when I used the CPU name which then returns only 2 results.
`import requests
import auto_scraper
import autoscraper
from autoscraper import AutoScraper
cpuUrl = 'https://www.techpowerup.com/cpu-specs'
gpuUrl = "https://www.techpowerup.com/gpu-specs/?mobile=No&workstation=No&sort=name"
We can add one or multiple candidates here.
You can also put urls here to retrieve urls.
cpu_wanted_list = {"Manufacturer":["AMD","Intel"],"Release Date":['2020','2021','2022','2023']}
#gpu_wanted_list = ["AMD","Intel"]
gpu_wanted_list = ["Nvidia","Geforce","AMD", "Radeon"]
scraper = AutoScraper()
cpuResult = scraper.build(cpuUrl, cpu_wanted_list)
gpuResult = scraper.build(gpuUrl, gpu_wanted_list)
print("Printing CPU relsult:")
print(cpuResult)
relatedCPUResult = scraper.get_result_similar('https://www.techpowerup.com/cpu-specs/?mobile=No&server=No&sort=name')
print(relatedCPUResult)`
I am going to https://www.techpowerup.com/cpu-specs/?mobile=No&server=No&sort=name and trying to fetch the table items as my result.
When I do get a result, it seems to be fetching values from the Refine Search parameters instead of the actual result:
Printing CPU relsult: ['Manufacturer', 'Release Date', 'Mobile', 'Server', 'TDP', 'Cores', 'Threads', 'Generation', 'Socket', 'Codename', 'Process', 'Multiplier Unlocked', 'Integrated Graphics'] ['AMD', 'Intel', '2022', 'No', '9 W', '2', 'Intel Pentium', 'AMD Socket 939', 'Alder Lake-S', '7 nm', 'Yes']
.I appended my code above in case, I am missing something and thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions