Skip to content

Commit

Permalink
added gogoanime notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
LordGhostX committed Oct 15, 2020
1 parent a5c6f01 commit 2b203d1
Show file tree
Hide file tree
Showing 2 changed files with 193 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
__pycache__
config.json
.ipynb_checkpoints
192 changes: 192 additions & 0 deletions gogoanime.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"from bs4 import BeautifulSoup"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# download anime\n",
"r = requests.get(\"https://gogoanime.so//search.html?keyword=\" + \"demon slayer\")\n",
"page = BeautifulSoup(r.text, \"html.parser\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"search_items = page.find(\"ul\", {\"class\": \"items\"}).find_all(\"li\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'https://gogoanime.so/category/kimetsu-no-yaiba'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"https://gogoanime.so\" + search_items[0].find(\"a\")[\"href\"]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"r = requests.get(\"https://gogoanime.so/category/kimetsu-no-yaiba\")\n",
"page = BeautifulSoup(r.text, \"html.parser\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"total_episodes = page.find(\"ul\", {\"id\": \"episode_page\"}).find_all(\"li\")[-1].find(\"a\")[\"ep_end\"]"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"('kimetsu-no-yaiba', '7754')"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"page.find(\"input\", {\"id\": \"alias_anime\"})[\"value\"], page.find(\"input\", {\"id\": \"movie_id\"})[\"value\"]"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"r = requests.get(\"https://ajax.gogocdn.net/ajax/load-list-episode?ep_start=0&ep_end=26&id=7754&default_ep=0&alias=kimetsu-no-yaiba\")\n",
"page = BeautifulSoup(r.text, \"html.parser\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'https://gogoanime.so/kimetsu-no-yaiba-episode-26'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"https://gogoanime.so\" + page.find_all(\"li\")[0].find(\"a\")[\"href\"].strip()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"r = requests.get(\"https://gogoanime.so/kimetsu-no-yaiba-episode-26\")\n",
"page = BeautifulSoup(r.text, \"html.parser\")"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"download_page = page.find(\"li\", {\"class\": \"dowloads\"}).find(\"a\")[\"href\"]"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"r = requests.get(download_page)\n",
"page = BeautifulSoup(r.text, \"html.parser\")"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Download (HDP - mp4)\n",
"https://cdn8.cloud9xx.com/user1342/487a00550db5a6d75f2936c1429cf232/EP.26.360p.mp4?token=YYyLGNaxjhVbdIj6npg9kg&expires=1602747090&id=130042\n"
]
}
],
"source": [
"print(\" \".join([i.strip() for i in page.find_all(\"div\", {\"class\": \"dowload\"})[0].text.split(\"\\n\")]))\n",
"print(page.find_all(\"div\", {\"class\": \"dowload\"})[1].find(\"a\")[\"href\"])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

0 comments on commit 2b203d1

Please sign in to comment.