Exemple #1
0
    def getMediaWithLoc(self, location):
        urlCity = []
        profilVisitedCity = {}

        url = "https://encrypted.google.com/search?q=site:instagram.com inurl:/locations inurl:/"
        url += location

        page = requests.get(url).text

        urls = getUrlGoogleSearch(page)

        for url in urls:
            if "instagram.com/explore/locations/" in url:
                find = re.search(r"[0-9]+/", url)
                if find:
                    place = re.findall(r"[0-9]+/(.*)", url)[0]
                    place = place.replace("-", " ").replace("/", ", ").strip()

                    if "?" in place:
                        place = place.split("?")[:-1][0]

                    urlCity.append(url)

        for url in urlCity:
            req = requests.get(url)

            if req.status_code == 200:
                profilVisitedCity = self._scrapperInstaExplorer(req.text)

                data = {"place": place}

                profilVisitedCity.update(data)

        return (profilVisitedCity)
Exemple #2
0
    def searchInsta(self, nom):
        accountsList = []

        url = "https://encrypted.google.com/search?num=20&q=\\%s site:instagram.com\\" % (
            nom)
        page = requests.get(url).text

        urls = getUrlGoogleSearch(page)

        for url in urls:
            if not "www.instagram.com/p/" in url:
                account = re.findall(r"instagram\.com/(.*?)/", url)
                if account:
                    accountsList.append(account[0])

        self.accounts = accountsList