使用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_uriWhich 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
最满意答案
散列算法通常比CRC好,因为它们碰撞较少; 现代哈希算法是作为
HashAlgorithm
类的后代实现的。 MD5和SHA1是常见的选择。AFAIK,.NET不包括CRC类,但我编写了CRC32和CRC16类,支持所有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.
相关问答
更多-
校验和计算正确一次,然后在Java中使用CRC32后不会(Checksum calculates correctly one time, then doesn't after with CRC32 in Java)[2022-05-06]
计算校验和时,必须将packet[2]设置为零。 在代码的某些部分,即函数generateAndSendPackets ,您重复使用相同的byte []来发送多个数据包,但是您在packet[2]中保留了先前的校验和字节,从而导致新的校验和值不正确。 byte packet[] = new byte[5]; for (byte messageNumber = 0; messageNumber <= 20; messageNumber++) { packet[0] = ... -
文件包含自己的校验和(File containing its own checksum)[2024-05-23]
是。 这是可能的,它是常见的简单的校验和。 获取文件以包含它自己的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); ...
-
将CRC值保存在文件中,而不更改实际的CRC校验和?(Save a CRC value in a file, without altering the actual CRC Checksum?)[2023-06-26]
简而言之,您需要从校验和计算中排除用于存储校验和的字节。 将校验和写入文件中的最后一件事。 根据除校验和之外的文件内容进行计算。 当您读取文件时,根据校验和之前的内容计算校验和。 或者,您可以将校验和作为随机访问文件的第一个字节。 只要你知道它在哪里。 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 ...