Skip to content

增加获取指定用户提问列表功能 #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: develop
Choose a base branch
from

Conversation

6xian
Copy link

@6xian 6xian commented May 6, 2017

def asks_list(self, **kwargs):
    question_list = []
    url = []
    url.append(URL.user_asks(self.slug))
    response = self._session.get(URL.user_asks(self.slug),**kwargs)
    soup = BeautifulSoup(response.content, "html.parser")
    page_tag = soup.find(name="div", class_="Pagination")
    if page_tag:
        url = []
        for button in page_tag.find_all("button"):
            if re.match(r'^\d$', button.get_text()):
                url.append(URL.user_asks(self.slug) + '?page=' + button.get_text())

    for page in url:
        response = self._session.get(page, **kwargs)
        soup = BeautifulSoup(response.content, "html.parser")
        tag_list = soup.find_all(name="div", class_="List-item")
        for name in tag_list:
            question_list.append(name.find("a").get_text())

    return question_list

@Fity
Copy link

Fity commented May 27, 2017

看起来 PR 提错了。。。
master 提到 develop 了。。。
顺便,原则上自己 forkmaster 应该只拿来和上游仓库同步用。新功能的开发应该开一个新分支来做,然后直接从这个分支提 PR 到上游。(所以需要一个 master 来和上游仓库保持同步)。具体细节可以找点 github flow 之类的东西看看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants