In [2]:
import requests, pandas as pd, numpy as np, json
from requests import session
from bs4 import BeautifulSoup

In [3]:
url='https://en.wikipedia.org/wiki/List_of_Survivor_(American_TV_series)_episodes'

In [4]:
response = requests.get(url)
soup = BeautifulSoup(response.content)

In [41]:
links=[j for j in [i for i in soup.findAll('a') if 'href' in str(i)] if '/wiki/Survivor' in j['href']]
links=[i['href'] for i in links if 'American_TV_series' not in i['href']]
links=[i for i in links if 'The_Interactive_Game' not in i]
links=list(set([i for i in links if '#' not in i]))
links


Out[41]:
['/wiki/Survivor:_Micronesia',
 '/wiki/Survivor:_Millennials_vs._Gen_X',
 '/wiki/Survivor:_Thailand',
 '/wiki/Survivor:_Caramoan',
 '/wiki/Survivor:_South_Pacific',
 '/wiki/Survivor:_Island_of_the_Idols',
 '/wiki/Survivor:_Cagayan',
 '/wiki/Survivor:_Guatemala',
 '/wiki/Survivor:_Africa',
 '/wiki/Survivor:_Edge_of_Extinction',
 '/wiki/Survivor:_San_Juan_del_Sur',
 '/wiki/Survivor:_Gabon',
 '/wiki/Survivor:_China',
 '/wiki/Survivor:_Game_Changers',
 '/wiki/Survivor:_Tocantins',
 '/wiki/Survivor:_Pearl_Islands',
 '/wiki/Survivor:_Panama',
 '/wiki/Survivor:_David_vs._Goliath',
 '/wiki/Survivor:_Blood_vs._Water',
 '/wiki/Survivor:_Ka%C3%B4h_R%C5%8Dng',
 '/wiki/Survivor:_Worlds_Apart',
 '/wiki/Survivor:_All-Stars',
 '/wiki/Survivor:_Cambodia',
 '/wiki/Survivor:_Heroes_vs._Healers_vs._Hustlers',
 '/wiki/Survivor:_Cook_Islands',
 '/wiki/Survivor:_Vanuatu',
 '/wiki/Survivor:_Palau',
 '/wiki/Survivor:_Marquesas',
 '/wiki/Survivor:_Samoa',
 '/wiki/Survivor:_Redemption_Island',
 '/wiki/Survivor:_Philippines',
 '/wiki/Survivor:_Borneo',
 '/wiki/Survivor:_The_Amazon',
 '/wiki/Survivor:_Winners_at_War',
 '/wiki/Survivor:_Ghost_Island',
 '/wiki/Survivor:_Heroes_vs._Villains',
 '/wiki/Survivor:_The_Australian_Outback',
 '/wiki/Survivor:_Fiji',
 '/wiki/Survivor:_One_World',
 '/wiki/Survivor:_Nicaragua']

In [43]:
link=links[0]

In [56]:
response = requests.get('https://en.wikipedia.org'+link)
soup = BeautifulSoup(response.content)

In [74]:
soup.findAll('table',{'role':'presentation'})[0]


Out[74]:
<table class="multicol" role="presentation" style="border-collapse: collapse; padding: 0; border: 0; background:transparent; width:100%;"><tbody><tr>
<td style="text-align: left; vertical-align: top;">
<table class="wikitable" style="text-align:center; width:100%">
<tbody><tr>
<th colspan="3">
</th>
<th colspan="4">Original tribes
</th>
<th colspan="6">Switched tribes
</th>
<th colspan="10">Merged tribe
</th></tr>
<tr>
<th colspan="3">Episode #
</th>
<th><a href="#ep230">1</a>
</th>
<th><a href="#ep231">2</a>
</th>
<th><a href="#ep232">3</a>
</th>
<th><a href="#ep233">4</a>
</th>
<th><a href="#ep234">5</a>
</th>
<th colspan="2"><a href="#ep235">6</a>
</th>
<th colspan="2"><a href="#ep236">7</a>
</th>
<th><a href="#ep237">8</a>
</th>
<th><a href="#ep238">9</a>
</th>
<th><a href="#ep239">10</a>
</th>
<th><a href="#ep240">11</a>
</th>
<th colspan="2"><a href="#ep241">12</a>
</th>
<th><a href="#ep242">13</a>
</th>
<th colspan="2"><a href="#ep243">14</a>
</th></tr>
<tr>
<th colspan="3">Day #
</th>
<td>3
</td>
<td>6
</td>
<td>8
</td>
<td>11
</td>
<td>14
</td>
<td>15
</td>
<td>17
</td>
<td>19
</td>
<td>20
</td>
<td>21
</td>
<td>24
</td>
<td>27
</td>
<td>30
</td>
<td>31
</td>
<td>33
</td>
<td>36
</td>
<td>37
</td>
<td>38
</td></tr>
<tr>
<th colspan="3">Eliminated
</th>
<td style="background:#8035B4; color:white;"><span class="nowrap">Jonny Fairplay</span>
</td>
<td style="background:#FF8D38;">Mary
</td>
<td style="background:#8035B4; color:white;"><span class="nowrap">Yau-Man</span>
</td>
<td style="background:#FF8D38;"><span class="nowrap">Mikey B</span>
</td>
<td style="background:#8035B4; color:white;">Joel
</td>
<td style="background:#FF8D38;">Jonathan
</td>
<td style="background:#8035B4; color:white;">Chet
</td>
<td style="background:#FF8D38;">Kathy
</td>
<td style="background:#8035B4; color:white;">Tracy
</td>
<td style="background:#8035B4; color:white;">Ami
</td>
<td style="background:#9CF03C;">Eliza
</td>
<td style="background:#9CF03C;">Ozzy
</td>
<td style="background:#9CF03C;">Jason
</td>
<td style="background:#9CF03C;">James
</td>
<td style="background:#9CF03C;">Alexis
</td>
<td style="background:#9CF03C;">Erik
</td>
<td style="background:#9CF03C;">Natalie
</td>
<td style="background:#9CF03C;">Cirie
</td></tr>
<tr>
<th colspan="3">Votes
</th>
<td style="background:#8035B4; color:white;">9–1
</td>
<td style="background:#FF8D38;"><span class="nowrap">6–2–2</span>
</td>
<td style="background:#8035B4; color:white;">6–2–1
</td>
<td style="background:#FF8D38;">6–3
</td>
<td style="background:#8035B4; color:white;">6–2
</td>
<td style="background:#FF8D38;"><i>Evacuated</i><sup class="reference" id="cite_ref-12"><a href="#cite_note-12">[a]</a></sup>
</td>
<td style="background:#8035B4; color:white;">5–2
</td>
<td style="background:#FF8D38;"><span class="nowrap"><i>Quit</i></span><sup class="reference" id="cite_ref-13"><a href="#cite_note-13">[b]</a></sup>
</td>
<td style="background:#8035B4; color:white;"><span class="nowrap">5–1</span>
</td>
<td style="background:#8035B4; color:white;"><span class="nowrap">4–1</span>
</td>
<td style="background:#9CF03C;">8–2
</td>
<td style="background:#9CF03C;">5–4
</td>
<td style="background:#9CF03C;">4–3–1
</td>
<td style="background:#9CF03C;"><span class="nowrap"><i>Evacuated</i></span><sup class="reference" id="cite_ref-14"><a href="#cite_note-14">[c]</a></sup>
</td>
<td style="background:#9CF03C;">2–0<sup class="reference" id="cite_ref-15"><a href="#cite_note-15">[d]</a></sup>
</td>
<td style="background:#9CF03C;">4–1
</td>
<td style="background:#9CF03C;">3–1
</td>
<td style="background:#9CF03C;">1–0
</td></tr>
<tr>
<td bgcolor="black" colspan="21">
</td></tr>
<tr>
<th colspan="3">Voter
</th>
<th colspan="18">Vote
</th></tr>
<tr>
<td style="background:#8035B4; color:white;">
</td>
<td style="background:#FF8D38;">
</td>
<td align="left" style="background:#9CF03C;">Parvati
</td>
<td style="background:#8035B4; color:white;">Jonny Fairplay
</td>
<td>
</td>
<td style="background:#8035B4; color:white;"><span class="nowrap">Yau-Man</span>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td style="background:#9CF03C;">Eliza
</td>
<td style="background:#9CF03C;">Ozzy
</td>
<td style="background:#9CF03C;">Jason
</td>
<td>
</td>
<td style="background:#9CF03C;">Alexis
</td>
<td style="background:#9CF03C;">Erik
</td>
<td style="background:#9CF03C;">Natalie
</td>
<td style="background:lightgrey;"><span class="nowrap">None<sup class="reference" id="cite_ref-Final_3_Vote_16-0"><a href="#cite_note-Final_3_Vote-16">[e]</a></sup></span>
</td></tr>
<tr>
<td style="background:#8035B4; color:white;">
</td>
<td style="background:#8035B4; color:white;">
</td>
<td align="left" style="background:#9CF03C;">Amanda
</td>
<td style="background:#8035B4; color:white;">Jonny Fairplay
</td>
<td>
</td>
<td style="background:#8035B4; color:white;"><span class="nowrap">Yau-Man</span>
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Joel
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Chet
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Tracy
</td>
<td style="background:#8035B4; color:white;">Ami
</td>
<td style="background:#9CF03C;">Eliza
</td>
<td style="background:#9CF03C;">Jason
</td>
<td style="background:#9CF03C;">Jason
</td>
<td>
</td>
<td style="background:#9CF03C;">Alexis
</td>
<td style="background:#9CF03C;">Erik
</td>
<td style="background:#9CF03C;">Natalie
</td>
<td style="background:#9CF03C;">Cirie
</td></tr>
<tr>
<td style="background:#8035B4; color:white;">
</td>
<td style="background:#8035B4; color:white;">
</td>
<td align="left" style="background:#9CF03C;">Cirie
</td>
<td style="background:#8035B4; color:white;">Jonny Fairplay
</td>
<td>
</td>
<td style="background:#8035B4; color:white;"><span class="nowrap">Yau-Man</span>
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Joel
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Chet
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Tracy
</td>
<td style="background:#8035B4; color:white;">Ami
</td>
<td style="background:#9CF03C;">Eliza
</td>
<td style="background:#9CF03C;">Ozzy
</td>
<td style="background:#9CF03C;">Jason
</td>
<td>
</td>
<td style="background:#9CF03C;"><s>Amanda</s>
</td>
<td style="background:#9CF03C;">Erik
</td>
<td style="background:#9CF03C;">Natalie
</td>
<td style="background:lightgrey;"><span class="nowrap">None<sup class="reference" id="cite_ref-Final_3_Vote_16-1"><a href="#cite_note-Final_3_Vote-16">[e]</a></sup></span>
</td></tr>
<tr>
<td style="background:#FF8D38;">
</td>
<td style="background:#FF8D38;">
</td>
<td align="left" style="background:#9CF03C;">Natalie
</td>
<td>
</td>
<td style="background:#FF8D38;">Mary
</td>
<td>
</td>
<td style="background:#FF8D38;">Mikey B
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td style="background:#9CF03C;">Eliza
</td>
<td style="background:#9CF03C;">Ozzy
</td>
<td style="background:#9CF03C;">James
</td>
<td>
</td>
<td style="background:#9CF03C;"><s>Amanda</s>
</td>
<td style="background:#9CF03C;">Erik
</td>
<td style="background:#9CF03C;">Cirie
</td>
<td bgcolor="darkgray">
</td></tr>
<tr>
<td style="background:#FF8D38;">
</td>
<td style="background:#8035B4; color:white;">
</td>
<td align="left" style="background:#9CF03C;">Erik
</td>
<td>
</td>
<td style="background:#FF8D38;">Mary
</td>
<td>
</td>
<td style="background:#FF8D38;"><span class="nowrap">Mikey B</span>
</td>
<td style="background:#8035B4; color:white;">Chet
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Chet
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Tracy
</td>
<td style="background:#8035B4; color:white;">Ami
</td>
<td style="background:#9CF03C;">Eliza
</td>
<td style="background:#9CF03C;">Jason
</td>
<td style="background:#9CF03C;">Jason
</td>
<td>
</td>
<td style="background:#9CF03C;"><s>Amanda</s>
</td>
<td style="background:#9CF03C;">Parvati
</td>
<td bgcolor="darkgray" colspan="2">
</td></tr>
<tr>
<td style="background:#FF8D38;">
</td>
<td style="background:#FF8D38;">
</td>
<td align="left" style="background:#9CF03C;">Alexis
</td>
<td>
</td>
<td style="background:#FF8D38;">Mary
</td>
<td>
</td>
<td style="background:#FF8D38;">Chet
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td style="background:#9CF03C;">Eliza
</td>
<td style="background:#9CF03C;">Ozzy
</td>
<td style="background:#9CF03C;">James
</td>
<td>
</td>
<td style="background:#9CF03C;"><s>Amanda</s>
</td>
<td bgcolor="darkgray" colspan="3">
</td></tr>
<tr>
<td style="background:#8035B4; color:white;">
</td>
<td style="background:#FF8D38;">
</td>
<td align="left" style="background:#9CF03C;">James
</td>
<td style="background:#8035B4; color:white;">Jonny Fairplay
</td>
<td>
</td>
<td style="background:#8035B4; color:white;"><span class="nowrap">Yau-Man</span>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td style="background:#9CF03C;">Eliza
</td>
<td style="background:#9CF03C;">Jason
</td>
<td style="background:#9CF03C;">Parvati
</td>
<td>
</td>
<td bgcolor="darkgray" colspan="4">
</td></tr>
<tr>
<td style="background:#FF8D38;">
</td>
<td style="background:#FF8D38;">
</td>
<td align="left" style="background:#9CF03C;">Jason
</td>
<td>
</td>
<td style="background:#FF8D38;">Chet
</td>
<td>
</td>
<td style="background:#FF8D38;">Chet
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td style="background:#9CF03C;">Ozzy
</td>
<td style="background:#9CF03C;">Ozzy
</td>
<td style="background:#9CF03C;">James
</td>
<td bgcolor="darkgray" colspan="5">
</td></tr>
<tr>
<td style="background:#8035B4; color:white;">
</td>
<td style="background:#8035B4; color:white;">
</td>
<td align="left" style="background:#9CF03C;">Ozzy
</td>
<td style="background:#8035B4; color:white;">Jonny Fairplay
</td>
<td>
</td>
<td style="background:#8035B4; color:white;"><span class="nowrap">Yau-Man</span>
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Joel
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Chet
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Tracy
</td>
<td style="background:#8035B4; color:white;">Ami
</td>
<td style="background:#9CF03C;">Eliza
</td>
<td style="background:#9CF03C;">Jason
</td>
<td bgcolor="darkgray" colspan="6">
</td></tr>
<tr>
<td style="background:#8035B4; color:white;">
</td>
<td style="background:#FF8D38;">
</td>
<td align="left" style="background:#9CF03C;">Eliza
</td>
<td style="background:#8035B4; color:white;">Jonny Fairplay
</td>
<td>
</td>
<td style="background:#8035B4; color:white;"><span class="nowrap">Yau-Man</span>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td style="background:#9CF03C;">Ozzy
</td>
<td bgcolor="darkgray" colspan="7">
</td></tr>
<tr>
<td style="background:#8035B4; color:white;">
</td>
<td align="left" colspan="2" style="background:#8035B4; color:white;">Ami
</td>
<td style="background:#8035B4; color:white;">Jonny Fairplay
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Cirie
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Joel
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Chet
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Tracy
</td>
<td style="background:#8035B4; color:white;">Erik
</td>
<td bgcolor="darkgray" colspan="8">
</td></tr>
<tr>
<td style="background:#FF8D38;">
</td>
<td align="left" colspan="2" style="background:#8035B4; color:white;">Tracy
</td>
<td>
</td>
<td style="background:#FF8D38;">Mary
</td>
<td>
</td>
<td style="background:#FF8D38;"><span class="nowrap">Mikey B</span>
</td>
<td style="background:#8035B4; color:white;">Joel
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Erik
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Ozzy
</td>
<td bgcolor="darkgray" colspan="9">
</td></tr>
<tr>
<td style="background:#FF8D38;">
</td>
<td align="left" colspan="2" style="background:#FF8D38;">Kathy
</td>
<td>
</td>
<td style="background:#FF8D38;">Mary
</td>
<td>
</td>
<td style="background:#FF8D38;"><span class="nowrap">Mikey B</span>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td bgcolor="darkgray" colspan="10">
</td></tr>
<tr>
<td style="background:#FF8D38;">
</td>
<td align="left" colspan="2" style="background:#8035B4; color:white;">Chet
</td>
<td>
</td>
<td style="background:#FF8D38;">Mary
</td>
<td>
</td>
<td style="background:#FF8D38;"><span class="nowrap">Mikey B</span>
</td>
<td style="background:#8035B4; color:white;">Joel
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Erik
</td>
<td bgcolor="darkgray" colspan="11">
</td></tr>
<tr>
<td style="background:#8035B4; color:white;">
</td>
<td align="left" colspan="2" style="background:#FF8D38;">Jonathan
</td>
<td style="background:#8035B4; color:white;">Jonny Fairplay
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Parvati
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td bgcolor="darkgray" colspan="12">
</td></tr>
<tr>
<td style="background:#FF8D38;">
</td>
<td align="left" colspan="2" style="background:#8035B4; color:white;">Joel
</td>
<td>
</td>
<td style="background:#FF8D38;">Tracy
</td>
<td>
</td>
<td style="background:#FF8D38;"><span class="nowrap">Mikey B</span>
</td>
<td style="background:#8035B4; color:white;">Chet
</td>
<td bgcolor="darkgray" colspan="13">
</td></tr>
<tr>
<td align="left" colspan="3" style="background:#FF8D38;">Mikey B
</td>
<td>
</td>
<td style="background:#FF8D38;">Chet
</td>
<td>
</td>
<td style="background:#FF8D38;">Chet
</td>
<td bgcolor="darkgray" colspan="14">
</td></tr>
<tr>
<td align="left" colspan="3" style="background:#8035B4; color:white;">Yau-Man
</td>
<td style="background:#8035B4; color:white;">Jonny Fairplay
</td>
<td>
</td>
<td style="background:#8035B4; color:white;">Parvati
</td>
<td bgcolor="darkgray" colspan="15">
</td></tr>
<tr>
<td align="left" colspan="3" style="background:#FF8D38;">Mary
</td>
<td>
</td>
<td style="background:#FF8D38;">Tracy
</td>
<td bgcolor="darkgray" colspan="16">
</td></tr>
<tr>
<td align="left" colspan="3" style="background:#8035B4; color:white;"><span class="nowrap">Jonny Fairplay</span>
</td>
<td style="background:#8035B4; color:white;">Ozzy
</td>
<td bgcolor="darkgray" colspan="17">
</td></tr></tbody></table>
<table class="wikitable" style="text-align:center;">
<tbody><tr>
<th colspan="3">Jury vote
</th></tr>
<tr>
<th><span class="nowrap">Episode #</span>
</th>
<th colspan="2"><a href="#ep244">15</a>
</th></tr>
<tr>
<th>Day #
</th>
<td colspan="2">39
</td></tr>
<tr>
<th>Finalist
</th>
<td style="background:#9CF03C;">Amanda
</td>
<td style="background:#9CF03C;">Parvati
</td></tr>
<tr>
<th>Votes
</th>
<td colspan="2" style="background:#9CF03C;">5–3
</td></tr>
<tr>
<td bgcolor="black" colspan="3">
</td></tr>
<tr>
<th>Juror
</th>
<th colspan="2">Vote
</th></tr>
<tr>
<td align="left" style="background:#9CF03C;">Cirie
</td>
<td>
</td>
<td style="background:#9CF03C;">Parvati
</td></tr>
<tr>
<td align="left" style="background:#9CF03C;">Natalie
</td>
<td>
</td>
<td style="background:#9CF03C;">Parvati
</td></tr>
<tr>
<td align="left" style="background:#9CF03C;">Erik
</td>
<td style="background:#9CF03C;">Amanda
</td>
<td>
</td></tr>
<tr>
<td align="left" style="background:#9CF03C;">Alexis
</td>
<td>
</td>
<td style="background:#9CF03C;">Parvati
</td></tr>
<tr>
<td align="left" style="background:#9CF03C;">James
</td>
<td style="background:#9CF03C;">Amanda
</td>
<td>
</td></tr>
<tr>
<td align="left" style="background:#9CF03C;">Jason
</td>
<td>
</td>
<td style="background:#9CF03C;">Parvati
</td></tr>
<tr>
<td align="left" style="background:#9CF03C;">Ozzy
</td>
<td style="background:#9CF03C;">Amanda
</td>
<td>
</td></tr>
<tr>
<td align="left" style="background:#9CF03C;">Eliza
</td>
<td>
</td>
<td style="background:#9CF03C;">Parvati
</td></tr></tbody></table>
<p>
</p>
</td></tr></tbody></table>

In [ ]: