How I made a Instagram Bot with face detection.

Instagram scraper with autopost and face detection.

I made an Instagram Bot which autoscraped peoples profiles took a machine learning module and reposted the images back to Instagram. I am new to python, so many of the fundamentals are missing, all feedback are good.

This was maybe my third python bot, I had played little around with different social network bots on Github, they all ended up on the same road, liking pictures of dogs, commercials and other weird stuff, I reached out to the bot creators most said it was impossible, too much work.

Download My Instagram Bot:
https://github.com/instagrambot/Instagram-scraper-with-autopost

How I implemented face detection

So i ended up implementing it myself with only 2 lines of code.

<span>image</span> <span>=</span> <span>face_recognition</span><span>.</span><span>load_image_file</span><span>(</span><span>instapath</span><span>)</span>
<span>face_locations</span> <span>=</span> <span>face_recognition</span><span>.</span><span>face_locations</span><span>(</span><span>image</span><span>)</span>
<span># If no face located scrape the next profile </span> <span>if</span> <span>not</span> <span>face_locations</span><span>:</span>
<span>print</span><span>(</span><span>"</span><span>There is no Face Detected scraping next profile</span><span>"</span><span>)</span>
<span>x</span> <span>+=</span> <span>1</span>
<span>instascraper</span><span>()</span>
<span>else</span><span>:</span>
<span>print</span><span>(</span><span>"</span><span>There is a Face Detected scraping and posting this image</span><span>"</span><span>)</span>
    <span>image</span> <span>=</span> <span>face_recognition</span><span>.</span><span>load_image_file</span><span>(</span><span>instapath</span><span>)</span>
    <span>face_locations</span> <span>=</span> <span>face_recognition</span><span>.</span><span>face_locations</span><span>(</span><span>image</span><span>)</span>
    <span># If no face located scrape the next profile </span>    <span>if</span> <span>not</span> <span>face_locations</span><span>:</span>
        <span>print</span><span>(</span><span>"</span><span>There is no Face Detected scraping next profile</span><span>"</span><span>)</span>
        <span>x</span> <span>+=</span> <span>1</span>
        <span>instascraper</span><span>()</span>
    <span>else</span><span>:</span>
        <span>print</span><span>(</span><span>"</span><span>There is a Face Detected scraping and posting this image</span><span>"</span><span>)</span>
image = face_recognition.load_image_file(instapath) face_locations = face_recognition.face_locations(image) # If no face located scrape the next profile if not face_locations: print("There is no Face Detected scraping next profile") x += 1 instascraper() else: print("There is a Face Detected scraping and posting this image")

Enter fullscreen mode Exit fullscreen mode

Face detection at work on a live webcam

I had already made the scraper/reposter myself within a few days, so to implement this code and it just worked.. was perfect

My script right now have a few third party packages and it’s really fun to see how easy it’s it to implement different modules. I think Python is a really fun language and the possibilities and endless.

My Instagram Scraper Website:
https://instabotai.com

Download My Instagram Bot:
https://github.com/instagrambot/Instagram-scraper-with-autopost

原文链接:How I made a Instagram Bot with face detection.

© 版权声明
THE END
喜欢就支持一下吧
点赞5 分享
The only thing standing between you and your dreams is a lot of hard work.
横跨在你和你的梦想之间的唯一的东西就是奋力拼搏
评论 抢沙发

请登录后发表评论

    暂无评论内容