python3 wcofun-cli.py https://www.wcofun.net/total-drama-world-tour-episode-1-walk-like-an-egyptian-part-1 ===========
wcofun-cli =========== >> fetching episode links and detecting seasons... Error fetching links: 403 Client Error: Forbidden for url: https://www.wcofun.net/total-drama-world-tour-episode-1-walk-like-an-egyptian-part-1 >> error: failed to fetch episode links or detect seasons.
I see the issue now. The website is blocking our requests with a 403 Forbidden error, which is a common anti-scraping measure. Let's modify the fetchEpisodes.py file to bypass these restrictions.
The website is using anti-scraping measures that are blocking our requests. I've updated the fetchEpisodes.py file with several techniques to bypass these restrictions:
Added Cloudscraper:
cloudscraper library which is specifically designed to bypass Cloudflare protectionEnhanced Browser Emulation:
Added Delays and Randomization:
Alternative Fetching Method:
Better Error Handling:
Install the new dependency:
pip install cloudscraperor
pip install -r requirements.txtRun the script again:
python wcofun-cli.py https://www.wcofun.net/total-drama-world-tour-episode-1-walk-like-an-egyptian-part-1The script should now be able to bypass the website's protection and successfully fetch the episode links. If you still encounter issues, the alternative method should kick in and provide a fallback solution specifically for Total Drama World Tour.
I've updated the code to run optimally on Ubuntu 22.04 and added several improvements:
Ubuntu 22.04 Compatibility:
Latest Library Versions:
VPS Optimizations:
New Features:
Clone the repository:
git clone https://github.com/yourusername/wcofun-cli.git
cd wcofun-cliRun the setup script:
chmod +x setup.sh
./setup.shRun the downloader:
source venv/bin/activate
python3 wcofun-cli.py https://www.wcofun.net/total-drama-world-tour-episode-1-walk-like-an-egyptian-part-1Optional: Install as a service:
chmod +x install_service.sh
./install_service.shThe updated code should work much better on an Ubuntu 22.04 VPS, with improved reliability and better integration with the operating system. The ffmpeg integration will also help with downloading streaming formats that might be problematic with the standard download method.
Fetching video URL for https://www.wcofun.net/total-drama-world-tour-episode-23-awwwwww-drumheller...
Found iframe: https://embed.watchanimesub.net/inc/embed/video-js.php?file=Total%20Drama%20seasons%201-3%2FTotal%20Drama%20World%20Tour%2FTDWT23%20-%20Awwwwww%2C%20Drumheller.flv&pid=163264&h=e44f6a7e1734c02dc4fd4998033509d3&t=1741316881&embed=anime ^CTraceback (most recent call last): File "/home/ubuntu/wcofun-cli/wcofun-cli.py", line 319, in <module> main() File "/home/ubuntu/wcofun-cli/wcofun-cli.py", line 238, in main fetch_result = fetchLinks(cartoon_url) File "/home/ubuntu/wcofun-cli/helpers/fetchEpisodes.py", line 109, in fetchLinks return fetchLinks(series_link) File "/home/ubuntu/wcofun-cli/helpers/fetchEpisodes.py", line 137, in fetchLinks video_url = extract_video_url(episode_soup, episode_url, scraper, headers) File "/home/ubuntu/wcofun-cli/helpers/fetchEpisodes.py", line 291, in extract_video_url iframe_response = scraper.get(iframe_src, headers=headers) File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/sessions.py", line 602, in get return self.request("GET", url, **kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/cloudscraper/init.py", line 259, in request self.perform_request(method, url, *args, **kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/cloudscraper/init.py", line 192, in perform_request return super(CloudScraper, self).request(method, url, *args, **kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( File "/home/ubuntu/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen response = self._make_request( File "/home/ubuntu/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 534, in _make_request response = conn.getresponse() File "/home/ubuntu/.local/lib/python3.10/site-packages/urllib3/connection.py", line 516, in getresponse httplib_response = super().getresponse() File "/usr/lib/python3.10/http/client.py", line 1375, in getresponse
response.begin() File "/usr/lib/python3.10/http/client.py", line 318, in begin version, status, reason = self._read_status() File "/usr/lib/python3.10/http/client.py", line 279, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/usr/lib/python3.10/socket.py", line 705, in readinto return self._sock.recv_into(b) File "/usr/lib/python3.10/ssl.py", line 1303, in recv_into return self.read(nbytes, buffer) File "/usr/lib/python3.10/ssl.py", line 1159, in read return self._sslobj.read(len, buffer)