Package: crawliexpress
CrawliexpressCrawliexpressDescriptionUsageInstallItemFeedbacksSearch / CategoryAPIDescriptionAllows to fetch various resources from Aliexpress, such as category, text search, product, feedbacks.It does not use official API nor a headless browser, but parses page source.Obviously, it is very vulnerable to DOM changes.UsageInstallpipinstallcrawliexpressItemfromcrawliexpressimportClientclient=Client("https://www.aliexpress.com")client.get_item("4000505787173")FeedbacksfromcrawliexpressimportClientfrompprintimportpprintfromtimeimportsleepclient=Client("https://www.aliexpress.com")item=client.get_item("20000001708485")page=1pages=list()whileTrue:feedback_page=client.get_feedbacks(item.product_id,item.owner_member_id,item.company_id,with_picture=True,page=page,)print(feedback_page.page)iffeedback_page.has_next_page()isFalse:breakpage+=1sleep(1)CategoryfromcrawliexpressimportClientfromtimeimportsleepclient=Client("https://www.aliexpress.com",# copy it from your browser cookies"xxxx",)page=1whileTrue:search_page=client.get_category(205000314,"t-shirts",page=page)print(search_page.page)ifsearch_page.has_next_page()isFalse:breakpage+=1sleep(1)Cookies must be taken from your browser cookies, to avoid captcha and empty results. I usually login then copy as cURL a request made by my browser on a category or a text search. Make sure to remove theCookie:prefix to keep only cookie values.SearchfromcrawliexpressimportClientfromtimeimportsleepclient=Client("https://www.aliexpress.com",# copy it from your browser cookies"xxxx",)page=1whileTrue:search_page=client.get_search("akame ga kill",page=page)print(search_page.page)ifsearch_page.has_next_page()isFalse:breakpage+=1sleep(1)Cookies must be taken from your browser cookies, to avoid captcha and empty results. I usually login then copy as cURL a request made by my browser on a category or a text search. Make sure to remove theCookie:prefix to keep only cookie values.APIclass crawliexpress.Category(client, category_id, category_name, sort_by='default')A categoryParameterscategory_id– id of the category, category id ofhttps://www.aliexpress.com/category/205000221/t-shirts.htmlis 205000220category_name– name of the category, category name ofhttps://www.aliexpress.com/category/205000221/t-shirts.htmlis t-shirtssort_by(default: best matchtotal_tranpro_desc: number of orders) – indeedclass crawliexpress.Client(base_url, cookies=None)Exposes methods to fetch various resources.Parametersbase_url– allows to change locale (not sure about this one)cookies– must be taken from your browser cookies, to avoid captcha and empty results. I usually login then copy as cURL a request made by my browser on a category or a text search. Make sure to remove theCookie:prefix to keep only cookie values.get_category(category_id, category_name, page=1, sort_by='default')Fetches a category pageParameterscategory_id– id of the category, category id ofhttps://www.aliexpress.com/category/205000221/t-shirts.htmlis 205000220category_name– name of the category, category name ofhttps://www.aliexpress.com/category/205000221/t-shirts.htmlis t-shirtspage– page numbersort_by(default: best matchtotal_tranpro_desc: number of orders) – indeedReturnsa search pageReturn typeCrawliexpress.SearchPageRaisesCrawliexpressException– if there was an error fetching the datazCrawliexpressCaptchaException– if there is a captcha, make sure to use valid cookies to avoid thisget_feedbacks(product_id, owner_member_id, company_id=None, v=2, member_type='seller', page=1, with_picture=False)Fetches a product feedback pageParametersproduct_id– id of the product, item id ofhttps://www.aliexpress.com/item/20000001708485.htmlis 20000001708485owner_member_id– member id of the product owner, as stored inCrawliexpress.Item.owner_member_idpage– page numberwith_picture– limit to feedbacks with a pictureReturnsa feedback pageReturn typeCrawliexpress.FeedbackPageRaisesCrawliexpressException– if there was an error fetching the datazget_item(item_id)Fetches a product informations from its idParametersitem_id– id of the product to fetch, item id ofhttps://www.aliexpress.com/item/20000001708485.htmlis 20000001708485Returnsa productReturn typeCrawliexpress.ItemRaisesCrawliexpressException– if there was an error fetching the datazget_search(text, page=1, sort_by='default')Fetches a search pageParameterstext– text searchpage– page numbersort_by(default: best matchtotal_tranpro_desc: number of orders) – indeedReturnsa search pageReturn typeCrawliexpress.SearchPageRaisesCrawliexpressException– if there was an error fetching the datazCrawliexpressCaptchaException– if there is a captcha, make sure to use valid cookies to avoid thisexception crawliexpress.CrawliexpressCaptchaException()exception crawliexpress.CrawliexpressException()class crawliexpress.Feedback()A user feedbackcomment( = None)Reviewcountry( = None)Country codedatetime( = None)Raw datetime from DOMimages( = None)List of image linksprofile( = None)Profile linkrating( = None)Rating out of 100user( = None)Nameclass crawliexpress.FeedbackPage()A feedback pagefeedbacks( = None)List ofCrawliexpress.Feedbackobjectshas_next_page()Returns true if there is a following page, useful for crawlingReturn typeboolknown_pages( = None)Sibling pagespage( = None)Page numberclass crawliexpress.Search(client, text, sort_by='default')A searchParameterstext– text searchsort_by(default: best matchtotal_tranpro_desc: number of orders) – indeedclass crawliexpress.SearchPage()A search pagehas_next_page()Returns true if there is a following page, useful for crawlingReturn typeboolitems( = None)List of products, raw from JS parsingpage( = None)page numberresult_count( = None)Number of result for the whole searchsize_per_page( = None)Number of result per page