问题描述
您好我想知道如何只从我拥有的脚本的源代码中打印data-user-id。
use strict;
使用LWP ::简单;
使用HTML :: TokeParser;
my $ content = get( https://twitter.com/joshuakhane);
死无法得到它!除非定义$ content;
my $ stream = HTML :: TokeParser-> new(\ $ content);
while(我的$ token = $ stream-> get_token){
if($ token-> [0] eq'T'){#text
#处理$ token->中的文字[1]
print $ token-> [1];
}
}
data-user-id =25971071在源代码里面,我只想得到它。
有谁可以提供帮助吗?
提前致谢。
Hello i would like to know how i can print only the data-user-id from the source code of the script i have.
use strict;
use LWP::Simple;
use HTML::TokeParser;
my $content = get("https://twitter.com/joshuakhane");
die "Couldn't get it!" unless defined $content;
my $stream = HTML::TokeParser->new(\$content);
while (my $token = $stream->get_token) {
if ($token->[0] eq 'T') { # text
# process the text in $token->[1]
print $token->[1];
}
}
data-user-id="25971071" is inside of the source code and i would like to get only that.
Anybody who could help?
Thanks in advance.
这篇关于刮特定文本perl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!