带有Python或Graph API的Facebook页面源代码

带有Python或Graph API的Facebook页面源代码,python,facebook-graph-api,web-scraping,beautifulsoup,Python,Facebook Graph Api,Web Scraping,Beautifulsoup,我有几百个Facebook用户名(不是朋友),我想获得这些人的Facebook用户名或个人URL链接 我可以手动按姓名搜索或键入此链接(),然后单击姓名或个人资料图片,然后进入此人的个人资料页面,只需复制URL() 我一直在尝试用Python,BeautifulSoup自动化这个过程。然而,Facebook使用了大量的隐藏元素,我的编程知识不足以胜任这份工作 所以我试着下载整个网页的源代码,然后在本地处理这些文件。我正在使用以下代码。这适用于http站点,但我无法使其适用于我的Facebook链

我有几百个Facebook用户名(不是朋友),我想获得这些人的Facebook用户名或个人URL链接

我可以手动按姓名搜索或键入此链接(),然后单击姓名或个人资料图片,然后进入此人的个人资料页面,只需复制URL()

我一直在尝试用Python,BeautifulSoup自动化这个过程。然而,Facebook使用了大量的隐藏元素,我的编程知识不足以胜任这份工作

所以我试着下载整个网页的源代码,然后在本地处理这些文件。我正在使用以下代码。这适用于http站点,但我无法使其适用于我的Facebook链接

由于我几乎没有编程知识,如果有人能帮我完成这段代码,而不是建议我使用无头浏览器等等,我将不胜感激

import urllib

# file where it will be stored to
rawSrc='C:\Users\JH\Desktop\webpages.txt';
linkSrc='C:\Users\JH\Desktop\links.txt';

# this function will download the source code and save it as a txt file.
def dlSrc():
    # Open first file where source code will be saved
    wRawSrc=open(rawSrc,'w')
    # connect and donwnload
    locPage='https://www.facebook.com/search/top/?q=Wilhelem%20Gabriella';
    webPage=urllib.urlopen(locPage)
    wPageSrc=webPage.read()
    webPage.close()
    # write to text file
    wRawSrc.write(wPageSrc)

# this function will extract all the links and save them on another txt file
def cleanFile():
    # open raw HTML source for reading
    rRawSrc=open(rawSrc,'r')
    # open the stripped one for writing
    wlinkSrc=open(linkSrc,'w')
    # export only the lines that contain "a href"
    for line in rRawSrc:
        if 'a href' in line:
            wlinkSrc.write(line)

# Run the functions
dlSrc()
cleanFile()

看看你想做什么是违反FB的政策。托比说了什么。这是不允许的,所以不要这样做。你会如何处理ID/数据?未经用户的特别授权,您也不允许以任何方式存储或使用它们。我想知道的是这可能吗?如果可能的话,应该用什么方法?