Ejemplo n.º 1
0
def searchPJ(requete='', num=''):
	def testResponse(requete):
		noReponse = soup.find("p", {"class": "wording-no-responses"})
		if noReponse:
			return 1

	page = requete.text #content.decode('utf-8')
	soup = BeautifulSoup(page, "html.parser")
	rep = testResponse(requete)
	if rep == 1:
		print(warning+" Aucun résultat pour votre recherche... o_o'")
		if num != '':
			pass

	TABLE_DATA = [
		('Name', 'Address', 'Phone', 'Line Phone')
	]

	profiles_list = soup.find_all("div", {"class":"zone-bi"})
	for profile in profiles_list:
		nameList = [n.text.strip() for n in profile.find_all("a", {"class": "denomination-links pj-lb pj-link"})][0]
		addressList = [a.text.strip() for a in profile.find_all("a", {"class": "adresse pj-lb pj-link"})][0]
		numList = [n.text.strip().replace(" ","") for n in profile.find_all("strong", {"class": "num"})]
		operator_list = []
		for n in numList:
			p = searchInfoNumero()
			p.search(n)
			operator_list.append(p.phone_type)

		TABLE_DATA.append((nameList, addressList, ", ".join(numList), ", ".join(operator_list)))

	if rep != 1:
		table_instance = SingleTable(TABLE_DATA, " Particulier ")
		table_instance.inner_row_border = True
		print("\n"+table_instance.table)
Ejemplo n.º 2
0
def search_number(codemonpays, num):

    headers = {
        'user-agent':
        'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
        'referrer': 'https://google.com',
        'Accept':
        'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
        'Accept-Encoding': 'gzip, deflate, br',
        'Accept-Language': 'en-US,en;q=0.9',
        'Pragma': 'no-cache'
    }

    if codemonpays == "FR":
        url = "https://www.pagesjaunes.fr/annuaireinverse/recherche?quoiqui="
        requete = requests.get(url + num, headers=headers)
        searchPJ(requete=requete, num=num)
        phone = searchInfoNumero()
        phone.search(num)

        TABLE_DATA = []

        city = phone.city
        operator = phone.operator
        location = phone.location
        _type = phone.phone_type

        infos = ("Numero", num)
        TABLE_DATA.append(infos)
        infos = ("Type", _type)
        TABLE_DATA.append(infos)
        infos = ("Operateur", operator)
        TABLE_DATA.append(infos)
        infos = ("City", city)
        TABLE_DATA.append(infos)
        infos = ("Localisation", location)
        TABLE_DATA.append(infos)

        table = SingleTable(TABLE_DATA)
        print("\n" + table.table)

    elif codemonpays == "CH":
        # search CH
        url = "https://tel.local.ch/fr/q?ext=1&rid=NV3M&name=&company=&street=&city=&area=&phone="
        searchLocalCH(url + num)

    elif codemonpays == "LU":
        url = "https://www.yellow.lu/fr/annuaire-inverse/recherche?query="
        searchYellowLU(url + num)

    else:
        # !!!! c'est deguelasse je sais... mais je n'avais pas le choix.. sa sera propre dans une prochaine MAJ... encore desole..
        url = "https://www.pagesjaunes.fr/annuaireinverse/recherche?quoiqui="
        requete = requests.get(url + num, headers=headers)
        searchPJ(requete=requete, num=num)
        phone = searchInfoNumero()
        phone.search(num)

        TABLE_DATA = []

        city = phone.city
        operator = phone.operator
        location = phone.location
        _type = phone.phone_type

        infos = ("Numero", num)
        TABLE_DATA.append(infos)
        infos = ("Type", _type)
        TABLE_DATA.append(infos)
        infos = ("Operateur", operator)
        TABLE_DATA.append(infos)
        infos = ("City", city)
        TABLE_DATA.append(infos)
        infos = ("Localisation", location)
        TABLE_DATA.append(infos)

        table = SingleTable(TABLE_DATA)
        print("\n" + table.table)

        url = "https://tel.local.ch/fr/q?ext=1&rid=NV3M&name=&company=&street=&city=&area=&phone="
        searchLocalCH(url + num)

        url = "https://www.yellow.lu/fr/annuaire-inverse/recherche?query="
        searchYellowLU(url + num)
Ejemplo n.º 3
0
def searchPageDor(requete='', num=''):
    def testResponse(requete):
        if 'Aucun résultat' in requete.text:
            return 1
            # print("[!] Aucun resultattttt pour votre recherche... o_o' ")

    page = requete.text  #content.decode('utf-8')
    soup = BeautifulSoup(page, "html.parser")
    rep = testResponse(requete)
    if rep == 1:
        print(warning + " Aucun résultat pour votre recherche... o_o'")
        if num != '':
            # phoneNumber(num)
            pass
        else:
            pass
    else:
        pass

    try:
        nameList = soup.find_all("h2", {"class": "result-item-title"})
        # print(nameList)
        addressList = soup.find_all("li", {"class": "address"})
        # print(addressList)
        numList = soup.find_all("li", {"class": "phone"})
        # input(numList)
        # name = name.string.strip()
        # adresse = adresse.string.strip()
        # num = num.string.strip()
        # printResult(name, adresse, num)
    except AttributeError:
        pass

    namesList2 = []
    addressesList2 = []
    numesList2 = []
    operatorList = []

    # try:
    for name in nameList:
        namesList2.append(name.text.strip())
    for addresse in addressList:
        addressesList2.append(addresse.text.strip())
    for num in numList:
        phone = searchInfoNumero()
        phone.search(num.text.strip())
        operator = phone.operator
        operatorList.append(operator)
        numesList2.append(num.text.strip())
    # except:
    # 	pass
    # 	print("[!] Aucun resultat pour votre recherche... o_o'")

    regroup = zip(namesList2, addressesList2, numesList2, operatorList)

    title = " Particulier "

    TABLE_DATA = [
        ('Name', 'Adresse', 'Phone', 'Operateur'),
    ]

    listeInfos = []

    for infos in regroup:

        try:

            TABLE_DATA.append(infos)

        except AttributeError:
            pass

    if rep != 1:
        table_instance = SingleTable(TABLE_DATA, title)
        print("\n" + table_instance.table)
Ejemplo n.º 4
0
def searchPJ(progress, self, te, requete='', num=''):
    def testResponse(requete):
        progress['value'] = 35
        self.update_idletasks()
        time.sleep(0.1)
        noReponse = soup.find("p", {"class": "wording-no-responses"})
        if noReponse:
            return 1

    progress['value'] = 30
    self.update_idletasks()
    time.sleep(0.1)

    page = requete.text  #content.decode('utf-8')
    soup = BeautifulSoup(page, "html.parser")
    rep = testResponse(requete)
    if rep == 1:
        messagebox.showerror("NO INFO",
                             " No results for your search ... o_o '")
        if num != '':
            pass

    TABLE_DATA = [('Name', 'Address', 'Phone', 'Line Phone')]

    progress['value'] = 40
    self.update_idletasks()
    time.sleep(0.1)

    profiles_list = soup.find_all("div", {"class": "zone-bi"})
    for profile in profiles_list:
        nameList = [
            n.text.strip() for n in profile.find_all(
                "a", {"class": "denomination-links pj-lb pj-link"})
        ][0]
        addressList = [
            a.text.strip()
            for a in profile.find_all("a", {"class": "adresse pj-lb pj-link"})
        ][0]
        numList = [
            n.text.strip().replace(" ", "")
            for n in profile.find_all("strong", {"class": "num"})
        ]
        operator_list = []
        for n in numList:
            p = searchInfoNumero()
            p.search(n)
            operator_list.append(p.operator.replace("Mobile - ", ""))

        TABLE_DATA.append((nameList, addressList, ", ".join(numList),
                           ", ".join(operator_list)))
    progress['value'] = 50
    self.update_idletasks()
    time.sleep(0.1)
    if rep != 1:
        table_instance = SingleTable(TABLE_DATA, " Particulier ")
        table_instance.inner_row_border = True
        te.insert(END, table_instance.table)
        progress['value'] = 70
        self.update_idletasks()
        time.sleep(0.1)
        # print("\n"+table_instance.table)