Comments (9)
It's creating a new dict from item.attrs
, containing only the keys which are present in key_attrs
. Also it is converting values of []
to ''
from autoscraper.
I understand your issue. I will make it as an option.
Until then, have you tried using grouped=True
parameter?
results per group won't be unique.
from autoscraper.
I didn‘t have tried the group function。I would try this later。
thx!
from autoscraper.
I tried and it didnt work for me.
from autoscraper.
Please share your url or html content and your code for it so we can find the problem.
from autoscraper.
The website is "https://selected-cigars.com/en/partagas-serie-d-no-4"
My wanted_list like ['Partagás - Serie D No. 4 1 piece','sold sout'].the store item just show once.
code:
from autoscraper import AutoScraper
url = 'https://selected-cigars.com/en/partagas-serie-d-no-4'
wanted_list = ['Partagás - Serie D No. 4 1 piece','Sold Out']
scraper = AutoScraper()
result = scraper.build(url,wanted_list)
print(result)
the output:
['Partagás - Serie D No. 4 1 piece', 'Partagás - Serie D No. 4 A/T 1Pc', 'Partagás - Serie D No. 4 A/T 3pcs', 'Partagás - Serie D No. 4 10pcs, wooden Box / 1 box per Customer', 'Partagás - Serie D No. 4 25pcs, wooden Box / 1 Box per Customer', 'Partagás - Serie D No. 4 A/T special 25er Metalltube', 'Sold Out', 'small quantities available']
In the output,the 'sold out ' item just show once.but in the web ,these items are more than 1.there are about 4 counts
from autoscraper.
I recommend to first use the grouped=True
parameter. After analyzing the output keep the desired rules by keep_rules
or remove_rules
methods. Then if you want to get the result list, use the unique=False
parameter.
from autoscraper.
THX
from autoscraper.
I was wondering how this works:
k: v if v != [] else '' for k, v in item.attrs.items() if k in key_attrs
I'm guessing it's shorthand for something. I didn't open a new issue as wanting to know how the code works doesn't seem like one.
from autoscraper.
Related Issues (20)
- Is there a way to call .sleep() during the build? HOT 1
- Getting candidate value in when trying scraping.
- ssl.SSLCertVerificationError: HOT 1
- How to scrape a dynamic website? HOT 2
- Not able to scrape images from amazon and flipkart from product pages HOT 5
- Could you update the README with static sites?
- Scrapping output is zero HOT 2
- How to scrap read more data given in the reviews? HOT 1
- How to get CSS or XPATH on which the auto-scrapper receives data from the page? HOT 1
- Package couldn't be installed HOT 2
- Ignores duplicate value HOT 4
- Possible to to try to extract main article from a page? HOT 1
- autoscraper for amazon not working HOT 2
- resolved
- How do I get the content extraction method itself?
- Youtube parsing doesn't work
- Data is not correct
- Not working for homeDepot links HOT 1
- Scrape local html files
- Unable to scrape data from paragraph (not JavaScript rendered) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autoscraper.