首页 \ 问答 \ 使用Scrapy或Instagram Python API访问Instagram中用户的所有关注者的用户名(Accessing the username of all the followers of a user in Instagram using Scrapy or Instagram Python API)

使用Scrapy或Instagram Python API访问Instagram中用户的所有关注者的用户名(Accessing the username of all the followers of a user in Instagram using Scrapy or Instagram Python API)

如何在Instagram中获取用户的每个关注者的用户名? 在json我只能访问追随者的数量。 这是我正在使用的json处理的URL:

"https://www.instagram.com/buzzfeed/?__a=1"
pprint(json_response["user"]["followed_by"]["count"])

这是pprint(json_response["user"])的开头pprint(json_response["user"])

    {u'biography': u"Hi, we're:q
 BuzzFeed dot com the website. Download our app:",
     u'blocked_by_viewer': False,
     u'connected_fb_page': None,
     u'country_block': False,
     u'external_url': u'http://bzfd.it/2cpjV5B',
     u'external_url_linkshimmed': u'http://l.instagram.com/?e=ATN_0_BAWjtGnChrZAtmnHUKqbPDjr3JcppPl3dQc7xbokFd56UvRHua36v9XsY&u=http%3A%2F%2Fbzfd.it%2F2cpjV5B',
     u'followed_by': {u'count': 2527289},
     u'followed_by_viewer': False,
     u'follows': {u'count': 127},
     u'follows_viewer': False,
     u'full_name': u'BuzzFeed',
     u'has_blocked_viewer': False,
     u'has_requested_viewer': False,
     u'id': u'1538653985',
     u'is_private': False,
     u'is_verified': True,
     u'media': {u'count': 2175,
                u'nodes': [{u'__typename': u'GraphVideo',
                            u'caption': u'me when I finally get paid',
                            u'code': u'BRJs_2Zj143',
                            u'comments': {u'count': 1330},
                            u'comments_disabled': False,
                            u'date': 1488491778,
                            u'dimensions': {u'height': 640, u'width': 640},

我可以看到u'follows_viewer': False但这是公共帐户,我可以从其Instagram帐户中看到buzzfeed的粉丝。 强烈建议任何想法。

更新:我通过使用Instagram API尝试了另一种方法,我得到了无,不知道出了什么问题:

print(api.user_followed_by(user_id=53112486))
([], None)
print(api.user_follows(user_id=53112486))
([], None)

我按照这种方法获取我的访问令牌,是错的吗?

https://api.instagram.com/oauth/authorize/?client_id=YOUR-CLIENT-ID&redirect_uri=YOUR-REDIRECT-URI&response_type=code&scope=basic+comments+follower_list+likes+relationships+public_content

我为我的redirect_uri使用了http://localhost:8515/oauth_callback

它问我这个问题: 在此处输入图像描述

我授权的!

也就是说,我可以获得自己帐户的计数(53112486是我的user_id):

info = api.user(user_id=53112486)
print(info.counts)

还有,当我试过

https://api.instagram.com/v1/users/self/followed-by?access_token=MINE

我得到了以下内容!

{"pagination": {}, "meta": {"code": 200}, "data": []}

这些都返回([], None)

 50         for page in api.user_followed_by( as_generator=True):
 51             print(str(page))
 52 
 53         print(api.user_follows(user_id=53112486))

How can I get the username of each of the followers of a user in instagram? In the json I can only have access to the number of the followers. Here is the URL for json processing I am using:

"https://www.instagram.com/buzzfeed/?__a=1"
pprint(json_response["user"]["followed_by"]["count"])

Here's the beginning of pprint(json_response["user"])

    {u'biography': u"Hi, we're:q
 BuzzFeed dot com the website. Download our app:",
     u'blocked_by_viewer': False,
     u'connected_fb_page': None,
     u'country_block': False,
     u'external_url': u'http://bzfd.it/2cpjV5B',
     u'external_url_linkshimmed': u'http://l.instagram.com/?e=ATN_0_BAWjtGnChrZAtmnHUKqbPDjr3JcppPl3dQc7xbokFd56UvRHua36v9XsY&u=http%3A%2F%2Fbzfd.it%2F2cpjV5B',
     u'followed_by': {u'count': 2527289},
     u'followed_by_viewer': False,
     u'follows': {u'count': 127},
     u'follows_viewer': False,
     u'full_name': u'BuzzFeed',
     u'has_blocked_viewer': False,
     u'has_requested_viewer': False,
     u'id': u'1538653985',
     u'is_private': False,
     u'is_verified': True,
     u'media': {u'count': 2175,
                u'nodes': [{u'__typename': u'GraphVideo',
                            u'caption': u'me when I finally get paid',
                            u'code': u'BRJs_2Zj143',
                            u'comments': {u'count': 1330},
                            u'comments_disabled': False,
                            u'date': 1488491778,
                            u'dimensions': {u'height': 640, u'width': 640},

I can see that u'follows_viewer': False but this is public account and I can see the followers of buzzfeed from its instagram account. Any idea is highly suggested.

UPDATE: I tried this other method by using Instagram API and I get None, not sure what went wrong:

print(api.user_followed_by(user_id=53112486))
([], None)
print(api.user_follows(user_id=53112486))
([], None)

I followed this method for getting my access token, is that wrong?

https://api.instagram.com/oauth/authorize/?client_id=YOUR-CLIENT-ID&redirect_uri=YOUR-REDIRECT-URI&response_type=code&scope=basic+comments+follower_list+likes+relationships+public_content

I used http://localhost:8515/oauth_callback for my redirect_uri

And it asked me this: enter image description here

Which I authorized!

That said, I can get the counts of my own account (53112486 is my user_id):

info = api.user(user_id=53112486)
print(info.counts)

Also, when I tried

https://api.instagram.com/v1/users/self/followed-by?access_token=MINE

I got the following!

{"pagination": {}, "meta": {"code": 200}, "data": []}

These both return ([], None):

 50         for page in api.user_followed_by( as_generator=True):
 51             print(str(page))
 52 
 53         print(api.user_follows(user_id=53112486))

原文:https://stackoverflow.com/questions/42568809
更新时间:2022-07-30 07:07

最满意答案

散列算法通常比CRC好,因为它们碰撞较少; 现代哈希算法是作为HashAlgorithm类的后代实现的。 MD5和SHA1是常见的选择。

AFAIK,.NET不包括CRC类,但我编写了CRC32CRC16类,支持所有CRC-32和CRC-16算法。

要计算校验和(无论是散列算法还是CRC),您必须读取整个文件,块大块,将文件数据传递给校验和算法。 完成整个文件后,从校验和算法中检索结果。


Hash algorithms are generally better than CRCs because they have fewer collisions; modern hash algorithms are implemented as descendents of the HashAlgorithm class. MD5 and SHA1 are common choices.

AFAIK, .NET does not include CRC classes, but I've written CRC32 and CRC16 classes that support all CRC-32 and CRC-16 algorithms.

To calculate the checksum (whether a hash algorithm or CRC), you'll have to read in the entire file, chunk by chunk, passing the file data to the checksum algorithm. When you're done with the entire file, retrieve the result from the checksum algorithm.

相关问答

更多
  • 计算校验和时,必须将packet[2]设置为零。 在代码的某些部分,即函数generateAndSendPackets ,您重复使用相同的byte []来发送多个数据包,但是您在packet[2]中保留了先前的校验和字节,从而导致新的校验和值不正确。 byte packet[] = new byte[5]; for (byte messageNumber = 0; messageNumber <= 20; messageNumber++) { packet[0] = ...
  • 是。 这是可能的,它是常见的简单的校验和。 获取文件以包含它自己的md5sum将是相当具有挑战性的。 在最基本的情况下,创建校验和值,这将使总和模数等于零。 校验和函数然后变成类似的东西 (n1 + n2 ... + CRC) % 256 == 0 如果校验和然后成为文件的一部分,并且自身被检查。 一个很常见的例子是信用卡号码中使用的Luhn算法 。 最后一位是一个校验位,它本身是16位数字的一部分。 I created a piece of code in C, then ran bruteforce ...
  • 从JavaScript,您将无法检测客户端计算机中的文件大小。 Javascript在沙箱内运行,无法访问本地系统文件,这将违反安全规定。 您可以使用silverlight并获取文件大小并计算总和。 你可以检查这个 Silverlight文件Uplaod From javascript you won't be able to detect the size of a file in the client computer. Javascript runs inside a sandbox and cann ...
  • 正如@ MrSmith42所说的,假如你不需要保持文件长度不变,那么可以很容易地计算出一个“冲突”(给两个输入消息给出相同散列的名字)。 它很繁琐,有很多点旋律,但非常快。 假设原始文件是十六进制的: 1122334455667788 然后使用标准的CRC32多项式,其CRC-32校验和将为0x9118E1C2 。 如果所使用的算法不是标准的,则可以替换它。 我将坚持用于演示目的的标准。 首先,根据需要更改文件。 例如,我在中间改变了一个字节: 11223344FF667788 第一步恢复CRC是用4个 ...
  • 不,像MD5,SHA,......这样的校验和纯粹是哈希。 即使一位的改变通常也会导致完全不同的校验和。 在cheksum和输入如何变化之间根本没有相关性。 NO, checksums like MD5, SHA, ... are purely hashes. Even a change in one bit typically results in completely different checksum. There is simply no correlation between how the c ...
  • 我的解决方案在这里找到: 如何在两个二进制类型之间的sql server中进行按位异或? 。 它涉及将每8个字节拆分为二进制(8)。 My solution was found here: How to do bitwise exclusive OR in sql server between two binary types?. It involved splitting every 8 bytes into binary(8).
  • 你看过Digest :: CRC吗? 来自文档:“它包含具有CRC-CCITT,CRC-16,CRC-32和CRC-64的正确参数的包装函数,以及OpenPGP的ASCII装甲校验和中使用的CRC。” use strict; use warnings; use Digest::CRC; my $ctx = Digest::CRC->new( type => 'crc32' ); open my $fh, '<:raw', $ARGV[0] or die $!; $ctx->addfile(*$fh); ...
  • 简而言之,您需要从校验和计算中排除用于存储校验和的字节。 将校验和写入文件中的最后一件事。 根据除校验和之外的文件内容进行计算。 当您读取文件时,根据校验和之前的内容计算校验和。 或者,您可以将校验和作为随机访问文件的第一个字节。 只要你知道它在哪里。 Simply put you need to exclude the bytes used to store the checksum from the checksum calculation. Write the checksum as the last ...
  • 散列算法通常比CRC好,因为它们碰撞较少; 现代哈希算法是作为HashAlgorithm类的后代实现的。 MD5和SHA1是常见的选择。 AFAIK,.NET不包括CRC类,但我编写了CRC32和CRC16类,支持所有CRC-32和CRC-16算法。 要计算校验和(无论是散列算法还是CRC),您必须读取整个文件,块大块,将文件数据传递给校验和算法。 完成整个文件后,从校验和算法中检索结果。 Hash algorithms are generally better than CRCs because they ...
  • 您目前只计算文件最后一个块的CRC。 为了将此传递当前crcvalue固定为crc32作为起始值: import zlib buffersize = 65536 with open('Pleiades_Spitzer_big.jpg', 'rb') as afile: buffr = afile.read(buffersize) crcvalue = 0 while len(buffr) > 0: crcvalue = zlib.crc32(buffr, crcv ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)