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 8071639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:45:05+00:00 2026-06-05T13:45:05+00:00

I am writing this little python program that will get new posts on the

  • 0

I am writing this little python program that will get new posts on the website http://www.fmylife.com and I want this program to print these new posts. An easy task even though I just started, but for some reason I cannot get the code to stop printing the same post.

import urllib.request,time

def getFml():
    rawfml = urllib.request.urlopen("http://www.fmylife.com")
    refml = rawfml.read()
    fml = refml.decode("utf8")
    rawfml.close()
    return fml
def parseFml(fml):
    fml=fml.split('Today,')
    fml=fml[1]
    for char in fml:
        if char in '0123456789<>/="#()-;:"\',':
            fml=fml.replace(char,'')
    fml=fml.split('FMLapdiv')
    fml=fml[0]
    fml=fml.split('aa')
    fml=''.join(fml)
    return fml
    listy=   ['date','left_parta','votej','idvotea','onclickvote','jTipa','comments','right_partp','fmllink','clear','post','hrefwork','class','dyn','javascript','div','classright_partp','hrefmiscellaneous','classdyncomments''div','article','idpa','classclear','classpost','hreflove','classfmlling','FMLap','classdate','classleft_parta','id_','nameresume','classjTipa','span','classdyn-commentsspan','classright_partpspan','classdyn-vote-j','idcotea','hrefjavascript;:','classfmllink','href']
for x in range(len(listy)):
    fml=fml.replace(listy[x],'')
    return fml
oldfml=''
count=0
while True:
    fml=getFml()
    fml=parseFml(fml)
    count=count+1
    if count>1:
        oldfml=fml

    if oldfml == fml:
        time.sleep(300)
    else:
        print('Today,'+fml)
        time.sleep(300)

My expected output was to get the post (which I did) and to print it. That works fine. The only problem is that I only want it to print the post once, and when it regularly checks up on the website it is getting printed multiple times and I do not know why.
Thanks To everyone in advance!

  • 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-05T13:45:08+00:00Added an answer on June 5, 2026 at 1:45 pm

    In this part of your code:

    while True:
        fml=getFml()
        fml=parseFml(fml)
        count=count+1
        if count>1:
            oldfml=fml
        if oldfml == fml:
            ...
    

    You assign oldfml=fml before you check their equality. Thus, they are always equal.

    I suggest the following fix:

    while True:
        if count>1:
            oldfml=fml
        count=count+1
        fml=getFml()
        fml=parseFml(fml)
        if oldfml == fml:
            ...
    

    This way, oldfml will actually be old.

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

Sidebar

Related Questions

I was writing this code for a C program that transforms letters to lower
I am writing a little python app. I want to be able to easily
I was writing a little program that takes a list and generates a menu
Still writing a game. This error's a little different, though. I get a trace
I ended up writing a quick little script for this in Python, but I
I'm writing a script in Python that will spit out some data organized as
I'm writing this little program in shell: #!/bin/bash #*************************************************************** # Synopsis: # Read from
This is my first question :). Im writing a little twitter app in PHP
I'm writing this URL in my browser: https://landfill.bugzilla.org/bugzilla-tip/post_bug.cgi?Bugzilla_login=mymail@hotmail.com&Bugzilla_password=password&product=WorldControl&version=1.0&component=WeatherControl&rep_platform=All&op_sys=All&priority=P2&bug_severity=normal&target_milestone=World%202.0&bug_status=CONFIRMED&assigned_to=somemail@hotmail.com&short_desc=bla&form_name=enter_bug&token=someToken or more clean: https://landfill.bugzilla.org/bugzilla-tip/post_bug.cgi ?Bugzilla_login=mymail@hotmail.com &Bugzilla_password=password
I am writing this code that one function calls itself recursively. But I am

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.