Giter Club home page Giter Club logo

Comments (9)

alirezamika avatar alirezamika commented on August 15, 2024 1

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.

alirezamika avatar alirezamika commented on August 15, 2024

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.

Mervyen avatar Mervyen commented on August 15, 2024

I didn‘t have tried the group function。I would try this later。
thx!

from autoscraper.

NickGoto avatar NickGoto commented on August 15, 2024

I tried and it didnt work for me.

from autoscraper.

alirezamika avatar alirezamika commented on August 15, 2024

Please share your url or html content and your code for it so we can find the problem.

from autoscraper.

Mervyen avatar Mervyen commented on August 15, 2024

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.

alirezamika avatar alirezamika commented on August 15, 2024

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.

Mervyen avatar Mervyen commented on August 15, 2024

THX

from autoscraper.

go-delicious avatar go-delicious commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.