So here is my code I am trying to compare. What I am trying to do is list the appids out of the path directory, which works. Then I am trying to go out to a website (f). And parse the html page and obtain the appids listed on that site.
What I want to be able to do is take appid from the local system, search f (app ids from the site), and return what the appid is.
When I print appid:
D:\python>jump_me.py |more
1b4dd67f29cb1962
28c8b86deab549a1
431a5b43435cc60b
4975d6798a8bdf66
7e4dca80246863e3
8eafbd04ec8631
9b9cdc69c1c24e2b
bc03160ee1a59fc1
When I print f, which is the parsed data from online I get:
65009083bfa6a094 | (app launched via XPMode) |
469e4a7982cea4d4 | ? (.job) |
b0459de4674aab56 | (.vmcx) |
89b0d939f117f75c | Adobe Acrobat 9 Pro Extended (32-bit) |
26717493b25aa6e1 | Adobe Dreamweaver CS5 (32-bit) |
e2a593822e01aed3 | Adobe Flash CS5 (32-bit) |
c765823d986857ba | Adobe Illustrator CS5 (32-bit) |
84f066768a22cc4f | Adobe Photoshop CS5 (64-bit) |
44a398496acc926d | Adobe Premiere Pro CS5 (64-bit) |
I want to compare appid with f, and print the corresponding item:
Like appid = 89b0d939f117f75c
f = 89b0d939f117f75c | Adobe Acrobat 9 Pro Extended (32-bit)
So I would want it to return, 89b0d939f117f75c | Adobe Acrobat 9 Pro Extended (32-bit) based on the directory listing.
Make sense?
—-code—-
import os
import sys
import urllib2
from BeautifulSoup import BeautifulSoup
path = ("C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations")
for ids in os.listdir(path):
appid = "%s" % (ids).rstrip('.automaticDestinations-ms')
#print appid
f = urllib2.urlopen("http://www.forensicswiki.org/wiki/List_of_Jump_List_IDs")
s = f.read()
soup = BeautifulSoup(''.join(s))
rows = soup.findAll('tr')
for tr in rows:
cols = tr.findAll('td', limit=2)
for td in cols:
text = ''.join(td.findAll(text=True))
print text + " |",
print "\n".strip()
f.close
You want to do something like:
I think. But it’s unclear to me where any of the data actually is: your example retrieved data doesn’t match what you’re doing with BeautifulSoup: that
tdis maybe the wrong place to be checking.The point though is that you need to be comparing
appidwith some substring of the text you’re searching through. You’re not doing any comparisons, though, so I don’t have any idea where you should be putting it.