Skip to content

Instantly share code, notes, and snippets.

@codewithpom
Created October 14, 2024 14:09
Show Gist options
  • Save codewithpom/455289f1eda6d49ddce4dafa0fa84644 to your computer and use it in GitHub Desktop.
Save codewithpom/455289f1eda6d49ddce4dafa0fa84644 to your computer and use it in GitHub Desktop.
import os
import requests
from bs4 import BeautifulSoup
import openai
# OpenAI API key (replace with your actual API key)
openai.api_key = 'API_KEY_HERE'
# URL of the NDTV Health page
url = 'https://www.ndtv.com/health'
# Make a GET request to fetch the raw HTML content
response = requests.get(url)
html_content = response.content
# Parse the HTML content with BeautifulSoup
soup = BeautifulSoup(html_content, 'html.parser')
# Find all the divs with class 'news_Itm'
news_items = soup.find_all('div', class_='news_Itm')
# Loop through the news items and stop at the first 'news_Itm' div with class 'adBg'
links = []
for news_item in news_items:
if 'adBg' in news_item.get('class', []):
break
# Find all anchor tags and get their href attributes (links)
link = news_item.find('a', href=True)
if link:
links.append(link['href'])
# Function to extend article content using OpenAI GPT-4 (chat endpoint)
def extend_text_with_gpt(text):
try:
# Call GPT-4 model using the chat endpoint
response = openai.ChatCompletion.create(
model="gpt-4",
messages=[
{"role": "system", "content": "You are an expert content rewritter and also write in markdown format."},
{"role": "user", "content": f"Please extend the following article to 700 words, avoiding plagiarism and adding a human touch:\n\n{text}"}
],
max_tokens=700, # Adjust the tokens to control the length of the extended content
temperature=0.9 # Adjust temperature for creative responses
)
# Return the extended content
return response['choices'][0]['message']['content'].strip()
except Exception as e:
print(f"Error with GPT-4 API: {e}")
return None
# Visit each link and extract the story body content
for link in links:
try:
# Get the content of the article page
article_response = requests.get(link)
article_soup = BeautifulSoup(article_response.content, 'html.parser')
# Get the div with id 'ins_storybody'
story_body = article_soup.find('div', id='ins_storybody')
# Extract text content if story_body exists
if story_body:
text_content = story_body.get_text(separator='\n').strip()
# Get the last part of the URL for the filename
file_name = link.rstrip('/').split('/')[-1] + '.txt'
# Extend the article content using GPT-4
extended_content = extend_text_with_gpt(text_content)
if extended_content:
# Save the extended content to a text file
with open(file_name, 'w', encoding='utf-8') as file:
file.write(extended_content)
print(f"Saved extended article content to {file_name}")
else:
print(f"Failed to extend content for {link}")
else:
print(f"No content found in {link}")
except Exception as e:
print(f"Error processing {link}: {e}")
# The Detrimental Health Effects of a Sedentary Lifestyle: It's More Serious Than You Might Think
"Sitting is the new smoking" is more than just a catchphrase. It underscores a growing health issue that is as alarming as the hazards of tobacco use. Extended periods of sitting, whether at a desk job or lounging at home, can precipitate various health problems, drawing a parallel with how smoking once emerged as a key contributor to preventable diseases.
A sedentary lifestyle, marked by long stretches of idleness and limited physical exertion, is raising eyebrows owing to its connection with numerous serious health risks. Like steering clear of injurious habits such as smoking, incorporating regular physical activity into one's routine has emerged as a major health imperative. Delve deeper as we shed light on the numerous harmful ramifications of leading a sedentary lifestyle.
## The Hidden Dangers of a Sedentary Lifestyle
### 1. Escalated Risk of Heart Disease
When you are stationary for lengthy intervals, it can result in inadequate circulation. In turn, this ramps up the risk of heart disease. The reason? As we idle, the blood flow slackens, and muscles don't expend as much fat, making it easy for fatty acids to block the arteries. This paves the way for elevated cholesterol levels and a heightened risk of cardiovascular disorders.
### 2. Greater Risk of Obesity
Living a sedentary life has a direct bearing on weight gain since fewer calories are used up compared to when you lead an active life. When you consume more calories than you burn, the surplus gets stored as fat, precipitating obesity. Obesity is a gateway to many other health problems, including diabetes and heart disease.
### 3. Onset of Type 2 Diabetes
Physical inactivity is a close ally of type 2 diabetes. When physical movement is minimal, the body's capacity to control blood sugar diminishes, leading to insulin resistance. Over time, this can maintain consistently high blood sugar levels, thus escalating the risk of diabetes.
### 4. Muscles and Bones Become Weaker
Lack of activity results in muscle atrophy and bone weakness, making one susceptible to osteoporosis and fractures. Regular movement is vital to uphold muscle bulk and bone density—it entices the production of new bone tissue and fortifies muscles, which in turn support the skeleton.
### 5. Heightened Risk of Depression and Anxiety
Physical idleness has adverse mental health effects. Sedentary behavior correlates with increased levels of stress, anxiety, and depression. Exercise facilitates the secretion of endorphins—chemicals that enhance mood and alleviate stress. Without adequate movement, mental wellbeing can deteriorate.
### 6. Bad Posture and Back Pain
Extended periods of sitting, especially with incorrect posture, exert pressure on the spine and debilitate core muscles, resulting in back pain and other musculoskeletal problems. Over time, faulty posture can lead to spinal misalignment and lasting discomfort, making it even more difficult to maintain an active lifestyle.
### 7. Shortened Lifespan
Leading a sedentary life could potentially reduce your lifespan. Research indicates that prolonged sitting and inactivity are linked with an escalated risk of premature death from all causes—even among those who exercise intermittently. The more you sit, the greater the threat to your overall health and longevity.
### 8. Digestive Issues
Sitting for long periods impedes the
# Prioritizing Fitness Amidst Busy Schedules: Anjali Mukerjee's Fitness Principles
Juggling between demanding work routines, familial obligations, and social commitments often lets the crucial aspect of fitness take a backseat in our lives. However, we should remember that maintaining a healthy physique doesn't always demand a rigorous gym routine. Pioneering nutritionist Anjali Mukerjee has shared some valuable health advice and revealed four principles on Instagram, highlighting that even simple, everyday activities can help individuals shed extra pounds and lead healthier lives. Approaching the year-end, Mukerjee inspires her followers to utilize the remaining three months judiciously and prioritize their health. Her motivational sentiments translate into, "The countdown to 2025 has begun, let's make these remaining months count! Set your fitness goals now. Your journey towards a healthier you begins this instant."
![Image](https://www.instagram.com/p/CV2hSvNLC8r/)
## Mukerjee's Four-Point Fitness Regime
Mukerjee outlines four pillars to maintaining our health and fitness, which are:
### 1. Work Out on an Empty Stomach
Popularly known as fasted exercise, Mukerjee asserts that this practice triggers extra calorie burn. In addition, other notable advantages include heightened mental clarity and focus, surge in Human Growth Hormone (HGH) production, promotion of autophagy (cell regeneration), improved digestion, and reduced bloating.
### 2. Engage Multiple Muscle Groups Together
This principle suggests that practices like Surya Namaskar, which engage multiple muscles in tandem, can lead to more efficient and time-saving workouts. The holistic benefits range from an increase in calorie burn, enhancement of overall strength, stability, coordination, and balance to a reduced risk of injuries through the strengthening of supportive muscles.
### 3. Practice Varying Heart Rates
As encapsulated by the concept of interval training, Mukerjee encourages varying heart rates for optimum fitness. This approach yields numerous benefits such as improved cardiovascular health and insulin sensitivity, enhanced calorie burn and weight loss, better anaerobic endurance, and decreased inflammation and oxidative stress.
### 4. Undertake Strenuous and Vigorous Exercise
Strength training, Mukerjee indicates, is desirable to build strength and push your limits. In addition to enhancing metabolism and encouraging fat loss, it also contributes to better mental health, which subsequently results in improved sleep quality.
Mukerjee's consistent contributions to health and fitness aren't new. She has previously shared her insights on effective weight loss strategies. Therefore, it's safe to say that these principles present a straightforward and efficient approach to achieving fitness goals, which can easily fit into our busy routines.
## Disclaimer
This article shares generic advice only. It is not intended to replace professional medical advice. Always consult with a healthcare provider for personalized advice. NDTV does not assume any responsibility for this information.
# Global Handwashing Day 2024: The Imperative of Thorough Handwashing
Global Handwashing Day is an international observance established to underscore the significance of maintaining good hand hygiene. Every year on October 15, this annual celebration serves as a global reminder about the pivotal role handwashing has in thwarting diseases and salvaging lives. It's a powerful message reinforcing that consistent handwashing with soap remains one of the most compelling ways to circumvent illnesses including diarrhoea and respiratory infections, particularly among children. Its recurring presence encourages governments, educational institutions, and communities to cultivate and uphold a culture of cleanliness and hygiene. Read on as we delve into the theme, significance, historical background of this day, and share essential tips to guarantee your handwashing habits are up to par.
## Theme
The Global Handwashing Partnership is the vanguard of a global mobilisation to accentuate the utmost importance of handwashing as the basic, inexpensive, yet efficient means to ward off germs. The theme for this year's Global Handwashing Day is "Why are clean hands still important?". An essential question that invokes a renewed understanding of the indispensable role good hand hygiene plays in counteracting infections.
## Significance
The true essence of Global Handwashing Day is embodied in its focus on the simple yet pivotal practice of handwashing that shields our health. Preserving good hand hygiene slashes the chances of infection transmission and diseases, thereby serving as a robust public health tool. This observance illuminates the criticality of maintaining clean hands in inhibiting disease outbreaks and pandemics, predominantly in regions where healthcare access is scanty or non-existent. By endorsing handwashing, this day contributes to enhancing health outcomes and curbing preventable deaths, especially among susceptible demographic groups like children under five.
## History
Global Handwashing Day came into being in 2008 under the purview of the Global Handwashing Partnership (GHP), a collective of international entities pledged to the cause of good hand hygiene. The maiden event was concurrent with the International Year of Sanitation, spearheaded by the United Nations. As years rolled by, it evolved into a global movement, with over 100 countries participating, including governmental bodies, educational institutions, and non-governmental organisations (NGOs). The chosen theme changes every year, directing focus on varying facets of hygiene while inspiring enduring alterations in handwashing habits.
## Common handwashing errors to avoid
**1. Neglecting soap use**
Soap is a crucial component in handwashing. It disintegrates the oils and dirt on your hands, a feat water alone can't accomplish. It generates the friction needed to dislodge germs and bacteria from the skin, making handwashing significantly more effective.
**2. Insufficient washing time**
A brief rinse under the faucet doesn't suffice. For handwashing to yield results, a thorough scrubbing for a minimum of 20 seconds is necessary.
**3. Incomplete hand drying**
Damp hands are more likely to transmit bacteria and germs than dry ones, so skipping proper drying can negate the benefits derived from washing hands thoroughly.
**4. Contact with unsanitary surfaces post-washing**
Touching a dirty surface like a faucet or door handle just after washing hands can annul the hygienic impact of the wash. To avoid this, use a tissue or your elbow to shut faucets and operate doors.
**5. Neglecting to cleanse all areas of the hand**
Certain portions of the
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment