Git Product home page Git Product logo

Comments (5)

ro-gi avatar ro-gi commented on May 22, 2024 2

Sorry but i don't know how to make pull request, i will learn

import json
import re

from holehe.core import *
from holehe.localuseragent import *

async def flickr(email, client, out):
    name = "flickr"
    debug = False
    url = "https://www.flickr.com/services/rest/"
    headers = {
        'User-Agent': random.choice(ua["browsers"]["chrome"]),
        'Accept': '*/*',
        'Accept-Language': 'en-US',
        'Connection': 'keep-alive',
        'TE': 'Trailers',
    }
    params = {
        "find_email": str(email),
        "format": "json",
        "api_key": "3bd7fc028a16a9d42c017814f4e91b9d",
        "method": "flickr.people.findByEmail"
    }
    
    
    # Start API get
    try:
        response = await client.get(url, headers=headers, params=params)        
    except Exception as e:
        if debug: 
            print("get error:\n", e)
        return_error()
    if debug:
        print(response)
        print(response.text)
    
    # parse response to serialize
    try:
        regx = "^jsonFlickrApi\(({.*})\)$"
        json_str = re.search(regx, response.text)[1]
        data = json.loads(json_str)
    except Exception as e:
        if debug:
            print("error, response can't be serialized:\n", e)
        return_error()

    # Check response
    if "stat" in data:
        if data["stat"] == "ok":
            if "user" in data:
                if "username" in data["user"]:
                    if "_content" in data["user"]["username"]:
                        out.append({
                            "name": name,
                            "rateLimit": False,
                            "exists": True,
                            "emailrecovery": None,
                            "phoneNumber": None,
                            "others": None
                            # "others": data["user"]["username"]["_content"]         
                        })
                        # Adding a value to "other" produce the error:
                        # File "/home/investigator/.local/lib/python3.7/site-packages/holehe/core.py", line 124, in maincore
                        #    toprint += " / FullName " + results["others"]["FullName"]
                        #    TypeError: string indices must be integers


                    else:
                        if debug:
                            print("no _content in data[user]")    
                        return_error()    
                else:
                    if debug:
                        print("no username in data")
                        print("data\n", data)
                    return_error()    
        elif data["stat"] == "fail":
            if "code" in data:
                if data["code"] == 1:
                    out.append({"name": name,
                        "rateLimit": False,
                        "exists": False,
                        "emailrecovery": None,
                        "phoneNumber": None,
                        "others": None})
                elif data["code"] == 100:
                    if debug:
                        print(data["message"])       
                    return_error()    
        else:
            if debug:
                print("unknown data stat: ", data["stat"] )
            return_error()
    else:
        if debug:
            print("No stat in data")
        return_error()


    def return_error():
        out.append({"name": name,
                    "rateLimit": True,
                    "exists": False,
                    "emailrecovery": None,
                    "phoneNumber": None,
                    "others": None})
        return None

from holehe.

ro-gi avatar ro-gi commented on May 22, 2024 2

from holehe.

megadose avatar megadose commented on May 22, 2024

Thanks you very much, the problem with your method is that if you ban the api key the module will not work anymore that's why nothing is hardcoded in holehe.

from holehe.

megadose avatar megadose commented on May 22, 2024

Thank you very much for telling me the problem is it's ok it's patch
image

from holehe.

ro-gi avatar ro-gi commented on May 22, 2024

from holehe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.