struck at gettiing each product urls from addidas website

8 views
Skip to first unread message

ram manoj Vuyyuru

unread,
Jun 21, 2021, 11:21:57 PM6/21/21
to django...@googlegroups.com
HI 
help me for getting urls for each product 
import pandas as pd
import requests
from bs4 import BeautifulSoup as bs 


page = requests.get(url)
soup = bs(page.text,"html.parser")

links=[]
listings = soup.find_all('div',{'class':'grid-item___3rAkS'})
for listing in listings:
    shoes_linklisting.find_all("a").a.get("href")
    cmplt_lnk=base_url+shoes_link
    links.append(cmplt_lnk)
    print(links)
 

my code :
when i run this i am not getting any result 

Lalit Suthar

unread,
Jun 22, 2021, 12:23:26 AM6/22/21
to django...@googlegroups.com
print(links) outside for loop. Even then if nothing prints means your `listings` is empty

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALJzFip9tmQTxygmWpqpc%3DqKHipNNf4HXhofGFXOPy3pp4bMCw%40mail.gmail.com.

ram manoj Vuyyuru

unread,
Jun 22, 2021, 12:36:17 AM6/22/21
to django...@googlegroups.com
Hi previous one prints nothing 

and this is another way but getting nothing 

import requests
from bs4 import BeautifulSoup


headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36'
}
for x in range(0,18):
    x=x*(12*4)
    r = requests.get(f'https://www.adidas.com.my/en/men-shoes?start={x}')
    soup = BeautifulSoup(r.content,'lxml')

    productlist = soup.find_all('div'class_='grid-item___3rAkS')

    productlinks=[]
    for item in productlist:
        for link in item.find_all('a',href=True):
            productlinks.append(base_urllink['href'])

print(productlinks)
thanks 

RANGA BHARATH JINKA

unread,
Jun 22, 2021, 12:38:50 AM6/22/21
to django...@googlegroups.com
Hi,

Try to print all the variables one by one. You will get to know from where the issue is coming from.
All the best



--
Thanks and Regards

J. Ranga Bharath
cell: 9110334114
Reply all
Reply to author
Forward
0 new messages