Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9184825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:08:51+00:00 2026-06-17T19:08:51+00:00

I have a html page with multiple javascript tags. The problem that I want

  • 0

I have a html page with multiple javascript tags. The problem that I want to extract data from specific tag:

<head>
...
</head>
<body>
...
<script type="text/javascript">

    $j(document).ready(function() {

        if (!($j.cookie("ios"))) {
            new $c.free.widgets.FreeAdvDialog().open();
            $j.cookie("ios", "seen", { path: '/', expires: 10000});
        };

        ajax_keys = ["d24349f205e3deb7f1015f42d3a14da7205b62e4", "0ae78c4797d47745ebd44e2754367da10c6f56a4", "567b2bfb6fd1aee784115da54e5e116a280ee225", "fc5cd251be46ff101c471553d52c07bf08c9aa65"];
        var is_dm = false;

        /* async chart loader */
        var chart = new $c.free.widgets.Chart({
            target: $j('#graph'),
            width: 990,
            height: 275,
            site: "911.com",
            source_panel: 'us'
        });

        var chart_view = new $c.free.widgets.ChartView({
            chart: chart,
            csv_button: 'csv-export',
            save_button: 'graph-image',
            embed_button: 'embed-graph',
            key: ajax_keys[1]
        });
        chart_view.render();

        /* zoom info initialization */
        var zoom_info = new $c.free.widgets.ZoomInfo({
            site: "911.com",
            el: '#zoominfo',
            key: ajax_keys[3]
        });
        zoom_info.load();


        /* compete numbers initialization */
        var compete_numbers = new $c.free.widgets.CompeteNumbers({
            site: "911.com",
            key: ajax_keys[0],
            el: '#compete_numbers'
        });
        compete_numbers.load();

        /* DM Marketing widget init */
        new $c.free.widgets.DMSignupMessage({
            is_dm: is_dm,
            compete_numbers: compete_numbers
        });

        /* personalization initialization */


            var logged_in_as = null;


        var d = {
          site_name: "911.com",
          logged_in_as: logged_in_as,
          current_source_panel: {"display_abbreviation": "us", "panel_name": "us", "image_url": "http://media.compete.com/site_media/images/icons/flag_us.gif", "id": 1, "display_name": "United States"}
        };

        var auth_model = new $c.free.widgets.FreeLoginModel(d);
        var links_opts = { model: auth_model };
        var links_view = new $c.free.widgets.FreeAccountLinksView(links_opts);

        var sites_view = new $c.free.widgets.FollowSiteButtonView(links_opts);
        var manage_view = new $c.free.widgets.ManageSitesListButtonView(links_opts);

        var sites = new $c.free.widgets.SimilarSitesCollection([], {
            site: "911.com",
            source_panel: 'us',
            key: ajax_keys[2],
            auth: auth_model
        });
        var graph = new $c.free.widgets.BarGraph({
            el: $j('#similar-sites'),
            collection: sites
        });

        // tell KISSMetrics where we are
        // also identify user so KM console can refer to them by email
        if(logged_in_as != null) {
            _kmq.push(['identify', logged_in_as]);
        }
        _kmq.push(['record', 'Viewed Free Site Analytics Report (M)']);
    });

…

How can I get ajax_keys (i.e. “d24349f205e3deb7f1015f42d3a14da7205b62e4”) from specific tag of the page?

p.s. i tried to use regular expressions in python script but i can’t retrieve necessary element from tag.

Thanks for help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:08:53+00:00Added an answer on June 17, 2026 at 7:08 pm

    If you use a library like BeautifulSoup you can fetch the specific script tag, and then use a regex on the contents of the tag instead of the entire document.

    That said, it looks like a regex will work assuming there is only the one ajax_keys:

    import re
    
    ajaxre = re.compile(r"^\s+ajax_keys = ([^;]+)", re.MULTILINE)
    ajax_string = ajaxre.match(source).group(1)
    
    # to get it as a python list
    import json
    ajax_keys = json.loads(ajax_string)
    

    Edit: thanks @Karl Knechtel for json.loads

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an html/javascript page that creates some data which is similar to a
I'm using JavaScript with HTML and I have a page that includes multiple iframes.
I have multiple javascript functions in my html page. One of them, by far
I have an HTML page that contains some filenames that i want to download
I have a UserControl that I want to include in a page multiple times
I have a widget-like block of HTML+JavaScript that people can copy/paste into their HTML-page
I have multiple html documents that share one css stylesheet (not multiple page div
I have a form on an HTML page with multiple submit buttons that perform
I have a need for a simple html + javascript page that must send
I have a html page that allows users to submit a file. Below is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.