how I can scrape table with BeautifulSoup
I try to scrape table data from aliexpress in transaction-history with BeautifulSoup, but it can't find when request.urlopen().read(), not sure how to get it or it's because of iframe ? Please help to suggest because I don't want to use the selenium
I already done with selenium, but I don't want to load chrome every time with driver.get, I would like to read from page source
import time
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.aliexpress.com/item/Modyle-2017-New-Fashion-Her-King-and-His-Queen-Stainless-Steel-Wedding-Rings-for-Women-Men/32827876813.html?spm=2114.search0104.3.2.b0db7b0bXHTbvz&ws_ab_test=searchweb0_0,searchweb201602_1_10065_10068_10890_319_10546_317_10548_5730311_10696_453_10084_454_10083_5729211_10618_10307_538_537_536_10059_10884_10887_100031_321_322_10103,searchweb201603_51,ppcSwitch_0&algo_expid=0ffd4f5b-afac-45be-ac7e-a0c97769e137-0&algo_pvid=0ffd4f5b-afac-45be-ac7e-a0c97769e137&transAbTest=ae803_3")
time.sleep(5)
#row = len(driver.find_elements_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr'))
row = 20
print("member level" + "," + "username" + "," + "user country" + "," + "order no" + "," + "order time")
for n in range(1,row+1) :
member = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/i').get_attribute("Class"))
username = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/span').text)
usercountry = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/div/b').text)
orderno = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[2]/div[1]').text)
ordertime = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[2]/div[2]').text)
print(member[-2:] + "," + username + "," + usercountry + "," + orderno + "," + ordertime)
I can scrape those field from selenium as the output below
member level,username,user country,order no,order time
A2,F***.,IT,1 piece,30 Dec 2018 13:46
python
add a comment |
I try to scrape table data from aliexpress in transaction-history with BeautifulSoup, but it can't find when request.urlopen().read(), not sure how to get it or it's because of iframe ? Please help to suggest because I don't want to use the selenium
I already done with selenium, but I don't want to load chrome every time with driver.get, I would like to read from page source
import time
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.aliexpress.com/item/Modyle-2017-New-Fashion-Her-King-and-His-Queen-Stainless-Steel-Wedding-Rings-for-Women-Men/32827876813.html?spm=2114.search0104.3.2.b0db7b0bXHTbvz&ws_ab_test=searchweb0_0,searchweb201602_1_10065_10068_10890_319_10546_317_10548_5730311_10696_453_10084_454_10083_5729211_10618_10307_538_537_536_10059_10884_10887_100031_321_322_10103,searchweb201603_51,ppcSwitch_0&algo_expid=0ffd4f5b-afac-45be-ac7e-a0c97769e137-0&algo_pvid=0ffd4f5b-afac-45be-ac7e-a0c97769e137&transAbTest=ae803_3")
time.sleep(5)
#row = len(driver.find_elements_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr'))
row = 20
print("member level" + "," + "username" + "," + "user country" + "," + "order no" + "," + "order time")
for n in range(1,row+1) :
member = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/i').get_attribute("Class"))
username = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/span').text)
usercountry = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/div/b').text)
orderno = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[2]/div[1]').text)
ordertime = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[2]/div[2]').text)
print(member[-2:] + "," + username + "," + usercountry + "," + orderno + "," + ordertime)
I can scrape those field from selenium as the output below
member level,username,user country,order no,order time
A2,F***.,IT,1 piece,30 Dec 2018 13:46
python
If you are trying to scrape transaction history, I am the only engineer behind Aliseeks.com . We have an API which provides what you need. The documentation isn't updated with the API endpoint but I can provide it to you. Check out the API and let me know if you need anything that you don't see.
– A. Bello
Jan 25 at 7:21
add a comment |
I try to scrape table data from aliexpress in transaction-history with BeautifulSoup, but it can't find when request.urlopen().read(), not sure how to get it or it's because of iframe ? Please help to suggest because I don't want to use the selenium
I already done with selenium, but I don't want to load chrome every time with driver.get, I would like to read from page source
import time
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.aliexpress.com/item/Modyle-2017-New-Fashion-Her-King-and-His-Queen-Stainless-Steel-Wedding-Rings-for-Women-Men/32827876813.html?spm=2114.search0104.3.2.b0db7b0bXHTbvz&ws_ab_test=searchweb0_0,searchweb201602_1_10065_10068_10890_319_10546_317_10548_5730311_10696_453_10084_454_10083_5729211_10618_10307_538_537_536_10059_10884_10887_100031_321_322_10103,searchweb201603_51,ppcSwitch_0&algo_expid=0ffd4f5b-afac-45be-ac7e-a0c97769e137-0&algo_pvid=0ffd4f5b-afac-45be-ac7e-a0c97769e137&transAbTest=ae803_3")
time.sleep(5)
#row = len(driver.find_elements_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr'))
row = 20
print("member level" + "," + "username" + "," + "user country" + "," + "order no" + "," + "order time")
for n in range(1,row+1) :
member = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/i').get_attribute("Class"))
username = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/span').text)
usercountry = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/div/b').text)
orderno = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[2]/div[1]').text)
ordertime = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[2]/div[2]').text)
print(member[-2:] + "," + username + "," + usercountry + "," + orderno + "," + ordertime)
I can scrape those field from selenium as the output below
member level,username,user country,order no,order time
A2,F***.,IT,1 piece,30 Dec 2018 13:46
python
I try to scrape table data from aliexpress in transaction-history with BeautifulSoup, but it can't find when request.urlopen().read(), not sure how to get it or it's because of iframe ? Please help to suggest because I don't want to use the selenium
I already done with selenium, but I don't want to load chrome every time with driver.get, I would like to read from page source
import time
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.aliexpress.com/item/Modyle-2017-New-Fashion-Her-King-and-His-Queen-Stainless-Steel-Wedding-Rings-for-Women-Men/32827876813.html?spm=2114.search0104.3.2.b0db7b0bXHTbvz&ws_ab_test=searchweb0_0,searchweb201602_1_10065_10068_10890_319_10546_317_10548_5730311_10696_453_10084_454_10083_5729211_10618_10307_538_537_536_10059_10884_10887_100031_321_322_10103,searchweb201603_51,ppcSwitch_0&algo_expid=0ffd4f5b-afac-45be-ac7e-a0c97769e137-0&algo_pvid=0ffd4f5b-afac-45be-ac7e-a0c97769e137&transAbTest=ae803_3")
time.sleep(5)
#row = len(driver.find_elements_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr'))
row = 20
print("member level" + "," + "username" + "," + "user country" + "," + "order no" + "," + "order time")
for n in range(1,row+1) :
member = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/i').get_attribute("Class"))
username = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/span').text)
usercountry = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[1]/div/div/b').text)
orderno = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[2]/div[1]').text)
ordertime = (driver.find_element_by_xpath('//*[@id="j-transaction-feedback"]/div[2]/div[1]/div[1]/table/tbody/tr[' + str(n) + ']/td[2]/div[2]').text)
print(member[-2:] + "," + username + "," + usercountry + "," + orderno + "," + ordertime)
I can scrape those field from selenium as the output below
member level,username,user country,order no,order time
A2,F***.,IT,1 piece,30 Dec 2018 13:46
python
python
asked Dec 31 '18 at 3:17
Nayot TientongNayot Tientong
84
84
If you are trying to scrape transaction history, I am the only engineer behind Aliseeks.com . We have an API which provides what you need. The documentation isn't updated with the API endpoint but I can provide it to you. Check out the API and let me know if you need anything that you don't see.
– A. Bello
Jan 25 at 7:21
add a comment |
If you are trying to scrape transaction history, I am the only engineer behind Aliseeks.com . We have an API which provides what you need. The documentation isn't updated with the API endpoint but I can provide it to you. Check out the API and let me know if you need anything that you don't see.
– A. Bello
Jan 25 at 7:21
If you are trying to scrape transaction history, I am the only engineer behind Aliseeks.com . We have an API which provides what you need. The documentation isn't updated with the API endpoint but I can provide it to you. Check out the API and let me know if you need anything that you don't see.
– A. Bello
Jan 25 at 7:21
If you are trying to scrape transaction history, I am the only engineer behind Aliseeks.com . We have an API which provides what you need. The documentation isn't updated with the API endpoint but I can provide it to you. Check out the API and let me know if you need anything that you don't see.
– A. Bello
Jan 25 at 7:21
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53983258%2fhow-i-can-scrape-table-with-beautifulsoup%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53983258%2fhow-i-can-scrape-table-with-beautifulsoup%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If you are trying to scrape transaction history, I am the only engineer behind Aliseeks.com . We have an API which provides what you need. The documentation isn't updated with the API endpoint but I can provide it to you. Check out the API and let me know if you need anything that you don't see.
– A. Bello
Jan 25 at 7:21