File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121limitations under the License.
2222"""
2323import os
24+ import glob
2425from copy import deepcopy
2526from goose .Article import Article
2627from goose .utils import URLHelper
@@ -125,11 +126,10 @@ def getExtractor(self):
125126 return StandardContentExtractor (self .config )
126127
127128 def releaseResources (self , article ):
128- directory = self .config .localStoragePath
129- for fname in os .listdir (directory ):
130- f = '%s/%s' % (self .config .localStoragePath , fname )
129+ path = '%s/%s_*' % (self .config .localStoragePath , article .linkhash )
130+ for fname in glob .glob (path ):
131131 try :
132- os .remove (f )
132+ os .remove (fname )
133133 except OSError :
134134 # TODO better log handeling
135135 pass
Original file line number Diff line number Diff line change 2020See the License for the specific language governing permissions and
2121limitations under the License.
2222"""
23+ import time
2324import hashlib
2425import re
2526import os
@@ -92,7 +93,7 @@ def getCleanedUrl(self, urlToCrawl):
9293 finalUrl = urlToCrawl .replace ('#!' , '?_escaped_fragment_=' ) \
9394 if '#!' in urlToCrawl else urlToCrawl
9495
95- linkhash = hashlib .md5 (finalUrl ).hexdigest ()
96+ linkhash = '%s.%s' % ( hashlib .md5 (finalUrl ).hexdigest (), time . time () )
9697
9798 return ParsingCandidate (finalUrl , linkhash , finalUrl )
9899
You can’t perform that action at this time.
0 commit comments