Hi stalkers
有沒有辦法直接訪問網站的資料?
我的代碼需要它:
@commands.command(aliases = ['isitsafe','issafe','scanlink'])
async def isthissafe(self, ctx, link: str):
try:
link = 'https://transparencyreport.google.com/safe-browsing/search?url=' link.replace('/','/')
embed=discord.Embed(
color = discord.Color.dark_red(),
title = '',
description = f"[Transparency Report verification]({link})")
await self.emb(embed, ctx.author.name, 'https://cwatch.comodo.com/images-new/check-my-site-security.png')
await ctx.send(embed=embed)
except:
await ctx.send('An error has occured')
print('\nERROR')
基本上我做了一個命令,它應該告訴鏈接是否安全,我使用谷歌的驗證報告網站做了它,但是..問題是我只是重新格式化了鏈接,所以機器人在嵌入中感知它,你可以從那里。
我的問題是,既然您了解了我的需求,是否有某種方法可以直接讓機器人從網站輸出指示該網站是否惡意/安全的訊息?
請幫我。
我還提供了一張圖片以及我想從該網站獲得的資訊。

uj5u.com熱心網友回復:
您可能想嘗試使用 bs4 抓取該站點,或者只查找字串“No unsafe content found”。但是,看起來 google 會根據請求填充該欄位。
您最好的選擇是使用 transparentreport.google.com/transparencyreport/api/v3/safebrowsing/status?site=SITE_HERE。它回傳一個 JSON 回應,但我不明白,所以玩弄一下,弄清楚鍵的含義
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/427900.html
