python - Parse HTML with JavaScript&jQuery - replace class names with random characters -


i'm trying parse html page additional javascript or jquery class names , replace random characters. can extract class names replacing causes trouble. have code far:

class_ids = [tag.split() tag in re.findall(r'class=(?:"|\')([a-za-z0-9-_\s]+)(?:"|\')', html_page)] class_ids = set([item sublist in class_ids item in sublist]) 

for each class i'll generate corresponding random characters class name (exp. footer : sjrh13li). replacing footer string through file replace in body text, class names title convert tag <title></title> <cjir4331></cjir4331>. i've tried replace whole line class="title" => class="cjir4331" doesn't solve problems class="title huge" because need detect classes title , huge separately , replace them. html code combined javascript code document.getelementsbyclassname('someclass') must converted document.getelementsbyclassname('noleretko4356').

is there way around this?

not sure understand trying do. trying obfuscate code before launching in production ? need preserve css associated elements ?

does helps ?

https://jsfiddle.net/p36pre5o/6/

$('#btn').click(function(){     var guid = generateuuid();     $('.test').removeclass('test').addclass(guid); }); 

this code find elements class test , replace random guid.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -