instagram图片下载_如何使用Python下载Instagram个人资料图片

instagram图片下载

So now, we are going to discuss about how to download the Instagram profile pictures via Python. So, let’s get into the topic.

所以现在,我们将讨论如何通过Python下载Instagram个人资料图片。 因此,让我们进入主题。

The instaloader is a package which I’m using to download the profile pictures from the Instagram, your friends profile pictures like, whatever the user name that you give as the input, the profile picture will get downloaded. So you can gather all these. Maybe you can have all the profile names in a text file and then you can pass it to the code, so that all your profile pics will be downloaded, so that you can use that for some kind of an image analysis in the proper way. OK, let’s jump into the code.

instaloader是一个软件包,我正在使用它从Instagram下载个人资料图片,您的朋友的个人资料图片就像,无论您输入的用户名是什么,都会下载个人资料图片。 这样您就可以收集所有这些信息。 也许您可以将所有配置文件名称保存在一个文本文件中,然后将其传递给代码,以便下载所有配置文件图片,以便您以适当的方式将其用于某种图像分析。 好,让我们进入代码。

Import instaloader
root=instaloader.Instaloader()usr_name=”Vishnu_aravindh28’Print(root.download_profile(usr_name,profile_pic_only=True))

说明 (Explanation)

So I’m creating an object, an instance for this instance loader, the package what I have downloaded and I created the instance name as route and now usr_name is a parameter, even you can pass it in the runtime as well or you can hardcode it. So I have given my personal Instagram profile name and then this is where the complete things will happen.

所以我要创建一个对象,该实例加载器的实例,我下载的包并创建实例名称作为route ,现在usr_name是一个参数,即使您也可以在运行时传递它,也可以硬编码它。 所以我给了我个人的Instagram个人资料名称,然后这是完整的事情发生的地方。

Print(root.download_profile (usr_name, profile_pic_only=True))

So this one liner is actually downloading your profile picture, whatever the user name that you have given, so route is the object name that you created, .download_profile is something that you will get as an inbuilt function within instaloader and the parameters that which we pass for this function download profile is, your usr_name, whatever the user name that you have given here, profile pic only. So you have options like a profile or profile pic or profile pic only, three options. So I’m choosing this profile pic only and I’m enabling it by giving true. So when you run code, this will create a directory and within that directory, your profile pictures, whatever the user name that you have given, with that name, a directory will be created. So within this, you get able to see the picture.

因此,无论您提供了什么用户名,这一行实际上都在下载您的个人资料图片,因此route是您创建的对象名称.download_profile是作为instaloader的内置函数以及我们所要获取的参数而获得的此功能的下载配置文件的传递文件是您的usr_name ,无论您在此处提供的用户名是什么, profile pic only 。 因此,您有三个选项,例如个人资料或个人资料图片或仅个人资料图片。 因此,我只选择此个人资料照片,并通过提供真实性来启用它。 因此,当您运行代码时,将创建一个目录,并在该目录中创建个人资料图片,无论您使用该名称指定了什么用户名,都将创建一个目录。 因此,您可以在其中看到图片。

So my agenda is just to explain you how to download the profile pic. So as I told you, you can make this as an automated way, like giving all the profile names in a text file and read the text file, pass that profile names to this usr_name function. So here you have to pass that. You can do with recursively by writing some loop, by reading from a file, and then you can download all those pictures and then you can use it for some proper way, like for doing some kind of an image analysis or whatever you want to do.

因此,我的议程只是向您解释如何下载个人资料图片。 因此,正如我告诉您的那样,您可以采用自动化方式,例如在文本文件中提供所有配置文件名称并读取文本文件,然后将该配置文件名称传递给此usr_name函数。 所以在这里您必须通过。 您可以通过编写一些循环,读取文件来递归地进行操作,然后下载所有这些图片,然后以某种适当的方式使用它,例如进行某种图像分析或您想要执行的任何操作。

I hope this is useful for you and Thanks for Reading!

希望对您有用,并感谢您的阅读!

翻译自: https://medium.com/swlh/how-to-download-your-instagram-profile-pic-using-python-c0f7d279b17c

instagram图片下载

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值