added new methods to pytester

This commit is contained in:
csparks 2019-09-08 00:34:11 +00:00
parent e5eaa28acd
commit 0b8e95c80f
4 changed files with 882 additions and 0 deletions

864
output.txt Normal file

File diff suppressed because one or more lines are too long

View file

@ -2,6 +2,7 @@
# coding=utf-8
from theHarvester.discovery import linkedinsearch
import pytest
import re
class TestGetLinks(object):
@ -12,5 +13,16 @@ def test_get_links(self):
links = search.get_links()
assert list(links)
def test_links_linkedin(self):
f = open("test_linkedin_links.txt").read()
reg_links = re.compile(r"url=https:\/\/www\.linkedin.com(.*?)&")
temp = reg_links.findall(f)
resul = []
for x in temp:
y = x.replace("url=", "")
resul.append("https://www.linkedin.com" + y)
assert set(resul)
if __name__ == '__main__':
pytest.main()

View file

@ -0,0 +1,5 @@
LinkedIn</a></h3><div class="s"><div class="hJND5c" style="margin-bottom:2px;word-wrap:break-word"><cite>https://www.linkedin.<b>com</b>/in/gm-tuhin-ialam-546526b8</cite></div><div class="f slp">Albany, New York Area&nbsp;-&nbsp;Facebook Advertising</div><span class="st">Gm Tuhin.ialam. <b>facebook</b>.<b>com</b> at Facebook Advertising. Albany, New York Area. <br>
Marketing and Advertising. Facebook Advertising. 0 connections&nbsp;...</span><br></div></div><div class="g"><h3 class="r"><a href="/url?url=https://in.linkedin.com/in/nikulact&amp;rct=j&amp;frm=1&amp;q=&amp;esrc=s&amp;sa=U&amp;ved=0ahUKEwjRpfC-9b_kAhVNnJ4KHcs9C2MQFggcMAM&amp;usg=AOvVaw1Bqufzx2E449oJST9BI5cT">NIKUL www.<b>facebook</b>.<b>com</b>/nikulact - Modeling - Self Modeling ...</a></h3><div class="s"><div class="hJND5c" style="margin-bottom:2px;word-wrap:break-word"><cite>https://in.linkedin.<b>com</b>/in/nikulact</cite><div class="Pj9hGd"><div style="display:inline" onclick="google.sham(this);" aria-expanded="false" aria-haspopup="true" tabindex="0" data-ved="0ahUKEwjRpfC-9b_kAhVNnJ4KHcs9C2MQ7B0IHTAD"><span class="CiacGf"></span></div><div style="display:none" class="am-dropdown-menu" role="menu" tabindex="-1"><ul><li class="mUpfKd"><a class="imx0m" href="/search?hl=en&amp;q=related:https://in.linkedin.com/in/nikulact&amp;tbo=1&amp;sa=X&amp;ved=0ahUKEwjRpfC-9b_kAhVNnJ4KHcs9C2MQHwgfMAM">Similar</a></li></ul></div></div></div><div class="f slp">Ahmedabad Area, India&nbsp;-&nbsp;Self Modeling</div><span class="st">View NIKUL www.<b>facebook</b>.<b>com</b>/nikulact&#39;s profile on LinkedIn, the world&#39;s largest <br>
professional community. NIKUL has 1 job listed on their profile. See the&nbsp;...</span><br></div></div><div class="g"><h3 class="r"><a href="/url?url=https://www.linkedin.com/in/victor-scott-9a967343&amp;rct=j&amp;frm=1&amp;q=&amp;esrc=s&amp;sa=U&amp;ved=0ahUKEwjRpfC-9b_kAhVNnJ4KHcs9C2MQFggiMAQ&amp;usg=AOvVaw2unq4BLAYGCfUquVZB3R4M">Victor Scott - Metal Band <b>facebook</b>.<b>com</b>/alchemyoftime - Alchemy of ...</a></h3><div class="s"><div class="hJND5c" style="margin-bottom:2px;word-wrap:break-word"><cite>https://www.linkedin.<b>com</b>/in/victor-scott-9a967343</cite></div><div class="f slp">Albany, New York Area&nbsp;-&nbsp;Alchemy of Time</div><span class="st">Victor Scott. Metal Band <b>facebook</b>.<b>com</b>/alchemyoftime at Alchemy of Time. Albany<br>
, New York Area. Music. Alchemy of Time. 1 connection&nbsp;...</span><br></div></div><div class="g"><h3 class="r"><a href="/url?url=https://www.linkedin.com/in/elkhorbat-lkhorbat-6028b33a&amp;rct=j&amp;frm=1&amp;q=&amp;esrc=s&amp;sa=U&amp;ved=0ahUKEwjRpfC-9b_kAhVNnJ4KHcs9C2MQFgglMAU&amp;usg=AOvVaw0CgoQP7h8_4jJ1WkOSC6TB">elkhorbat lkhorbat - http://www.<b>facebook</b>.<b>com</b>/pages/elkhorbat ...</a></h3><div class="s"><div class="hJND5c" style="margin-bottom:2px;word-wrap:break-word"><cite>https://www.linkedin.<b>com</b>/in/elkhorbat-lkhorbat-6028b33a</cite></div><div class="f slp">United States&nbsp;-&nbsp;http://www.facebook.com/pages/elkhorbat/302997479939</div><span class="st">View elkhorbat lkhorbat&#39;s profile on LinkedIn, the world&#39;s largest professional <br>
community. elkhorbat has 1 job listed on their profile. See the complete profile on<br>

View file

@ -35,6 +35,7 @@ def get_people(self):
return rawres.people_linkedin()
def get_links(self):
print(self.totalresults)
links = myparser.Parser(self.totalresults, self.word)
return links.links_linkedin()