Home > Software design >  Is there a way to access every website's data through discord.py
Is there a way to access every website's data through discord.py

Time:02-18

Hi stalkers

Is there a way to access a site's data directly?

I need it for my code :

@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')

Basically I made, a command which should tell if a link is safe or not, I did it using google's verification report site, but.. the problem is I only reformatted the link so the bot sens it in an embed and you access it from there.

My question is, now that you understood what I need, is there some way in which I could directly let the bot output the message from the website that indicates if the site is malicious/safe ??

Please help me.

I provided an image as well with the message I want to get from the site.

The message I want to get from this link, for example is No unsafe content found.

CodePudding user response:

You might want to try scraping the site with bs4, or just look for the string "No unsafe content found". However, it looks like google populates the field based on a request.enter image description here
Your best bet would be to use transparencyreport.google.com/transparencyreport/api/v3/safebrowsing/status?site=SITE_HERE. It returns a JSON response, but I don't understand it, so play around and figure out what the keys mean

  • Related