Skip to content

Commit

Permalink
fix crawler not fit PEP8 global variable declaration problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanonymous-GitHub committed Mar 28, 2020
1 parent bb50008 commit 5ba0455
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crawler.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import requests
from bs4 import BeautifulSoup

base_url = "https://www.ptt.cc/bbs/"


# 取出頁數或是 id
def get_last_session_of_url(url) -> str:
Expand All @@ -14,7 +12,7 @@ def get_last_session_of_url(url) -> str:


def get_article(id_, board="Gossiping", is_include_content=False) -> dict:
global base_url
base_url = "https://www.ptt.cc/bbs/"
if board is None:
board = "Gossiping"
url = base_url + board + "/" + id_ + '.html'
Expand Down Expand Up @@ -57,7 +55,7 @@ def get_article(id_, board="Gossiping", is_include_content=False) -> dict:


def get_article_ids(board="Gossiping", page="") -> dict:
global base_url
base_url = "https://www.ptt.cc/bbs/"
if page is None:
page = ""

Expand Down

0 comments on commit 5ba0455

Please sign in to comment.