BeautifulSoup.find() is returning None, unable to access table on wiki page
up vote
2
down vote
favorite
import requests
from bs4 import BeautifulSoup
url = "http://leagueoflegends.wikia.com/wiki/List_of_items'_stats"
page = requests.get(url).text
pageSoup = BeautifulSoup(page, 'html5lib')
table = pageSoup.find('table',{'class':'wikitable sortable'})
print(table)
I am trying to access the data from a table on a wiki page. I have already accessed the table on another page, however the return I am getting from the find function from this page is None. Also, when i print all p tags, there is only one p tag in the whole of the soup, which seems strange to say the least, therefore I think there might be an error in the way I am accessing the html. Any help would be appreciated.
python-3.x beautifulsoup python-requests
add a comment |
up vote
2
down vote
favorite
import requests
from bs4 import BeautifulSoup
url = "http://leagueoflegends.wikia.com/wiki/List_of_items'_stats"
page = requests.get(url).text
pageSoup = BeautifulSoup(page, 'html5lib')
table = pageSoup.find('table',{'class':'wikitable sortable'})
print(table)
I am trying to access the data from a table on a wiki page. I have already accessed the table on another page, however the return I am getting from the find function from this page is None. Also, when i print all p tags, there is only one p tag in the whole of the soup, which seems strange to say the least, therefore I think there might be an error in the way I am accessing the html. Any help would be appreciated.
python-3.x beautifulsoup python-requests
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
import requests
from bs4 import BeautifulSoup
url = "http://leagueoflegends.wikia.com/wiki/List_of_items'_stats"
page = requests.get(url).text
pageSoup = BeautifulSoup(page, 'html5lib')
table = pageSoup.find('table',{'class':'wikitable sortable'})
print(table)
I am trying to access the data from a table on a wiki page. I have already accessed the table on another page, however the return I am getting from the find function from this page is None. Also, when i print all p tags, there is only one p tag in the whole of the soup, which seems strange to say the least, therefore I think there might be an error in the way I am accessing the html. Any help would be appreciated.
python-3.x beautifulsoup python-requests
import requests
from bs4 import BeautifulSoup
url = "http://leagueoflegends.wikia.com/wiki/List_of_items'_stats"
page = requests.get(url).text
pageSoup = BeautifulSoup(page, 'html5lib')
table = pageSoup.find('table',{'class':'wikitable sortable'})
print(table)
I am trying to access the data from a table on a wiki page. I have already accessed the table on another page, however the return I am getting from the find function from this page is None. Also, when i print all p tags, there is only one p tag in the whole of the soup, which seems strange to say the least, therefore I think there might be an error in the way I am accessing the html. Any help would be appreciated.
python-3.x beautifulsoup python-requests
python-3.x beautifulsoup python-requests
asked 2 days ago
AlpacaJones
133
133
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
The issue is that there is a dynamic tab mechanism going on in the background. You should select the tab which you want and use the link for that. For example if you would like to see the Offensive tab, you can right click and open the corresponding page, which will give you the correct url, then with this your code is running correctly:
url = 'http://leagueoflegends.wikia.com/wiki/List_of_items%27_stats/Offensive'
1
Ah worked like a charm. Thank you very much. I'm a bit lost when it comes to anything more than basic webpages, I'll have to try and learn more on that to improve my scripts. Thanks again.
– AlpacaJones
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
The issue is that there is a dynamic tab mechanism going on in the background. You should select the tab which you want and use the link for that. For example if you would like to see the Offensive tab, you can right click and open the corresponding page, which will give you the correct url, then with this your code is running correctly:
url = 'http://leagueoflegends.wikia.com/wiki/List_of_items%27_stats/Offensive'
1
Ah worked like a charm. Thank you very much. I'm a bit lost when it comes to anything more than basic webpages, I'll have to try and learn more on that to improve my scripts. Thanks again.
– AlpacaJones
yesterday
add a comment |
up vote
0
down vote
accepted
The issue is that there is a dynamic tab mechanism going on in the background. You should select the tab which you want and use the link for that. For example if you would like to see the Offensive tab, you can right click and open the corresponding page, which will give you the correct url, then with this your code is running correctly:
url = 'http://leagueoflegends.wikia.com/wiki/List_of_items%27_stats/Offensive'
1
Ah worked like a charm. Thank you very much. I'm a bit lost when it comes to anything more than basic webpages, I'll have to try and learn more on that to improve my scripts. Thanks again.
– AlpacaJones
yesterday
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
The issue is that there is a dynamic tab mechanism going on in the background. You should select the tab which you want and use the link for that. For example if you would like to see the Offensive tab, you can right click and open the corresponding page, which will give you the correct url, then with this your code is running correctly:
url = 'http://leagueoflegends.wikia.com/wiki/List_of_items%27_stats/Offensive'
The issue is that there is a dynamic tab mechanism going on in the background. You should select the tab which you want and use the link for that. For example if you would like to see the Offensive tab, you can right click and open the corresponding page, which will give you the correct url, then with this your code is running correctly:
url = 'http://leagueoflegends.wikia.com/wiki/List_of_items%27_stats/Offensive'
answered 2 days ago
zsomko
1816
1816
1
Ah worked like a charm. Thank you very much. I'm a bit lost when it comes to anything more than basic webpages, I'll have to try and learn more on that to improve my scripts. Thanks again.
– AlpacaJones
yesterday
add a comment |
1
Ah worked like a charm. Thank you very much. I'm a bit lost when it comes to anything more than basic webpages, I'll have to try and learn more on that to improve my scripts. Thanks again.
– AlpacaJones
yesterday
1
1
Ah worked like a charm. Thank you very much. I'm a bit lost when it comes to anything more than basic webpages, I'll have to try and learn more on that to improve my scripts. Thanks again.
– AlpacaJones
yesterday
Ah worked like a charm. Thank you very much. I'm a bit lost when it comes to anything more than basic webpages, I'll have to try and learn more on that to improve my scripts. Thanks again.
– AlpacaJones
yesterday
add a comment |
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%2f53402804%2fbeautifulsoup-find-is-returning-none-unable-to-access-table-on-wiki-page%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